I want to add two values ββto the cookie and get them. I do this, but I get only the first value, not the second.
Cookie c = new Cookie("a", a); c.setMaxAge(60); response.addCookie(c); Cookie b = new Cookie("d", d); b.setMaxAge(5 * 60); response.addCookie(b);
When reading:
Cookie cookies[] = getRequest().getCookies(); Cookie myCookie = null; if (cookies != null) { for (int i = 0; i < cookies.length; i++) { log.info("test ;;;"+cookies[i].getName()); } }
This returns only one information.
, . cookie , . , , , , (, , cookie), cookie. , (, JSP).
/ / , . FireFox Firebug ( Firebug, Net, , , /, cookie).
- :
for(int i= 0; i < cookies.length; i++) { Cookie cookie = cookies[i]; log.info("name: " + cookie.getName()) log.info("value: " + cookie.getValue()) }
cookie. , , cookie . , cookie .
- ,
response.addCookie( Cookie ( "", "" )); response.addCookie( Cookie ( "pwd", "sunnymehta" ));
Cookie [] cookie = request.getCookies(); (Cookie ck: cookie) { System.out.println(ck.getName()); }
cookie, . , , - , , cookie, - cookie - . http://www.quirksmode.org/js/cookies.html , cookie. ( , -, cookie, , .)
I understand that your java calls should write a file formatted in a formatted cookie and create a valid array of cookies for you. But the fact that you get one object back seems suspicious to me in the light of the basic cookie data format.
In the past, I used Cookie Pal to check raw cookies, although the site mentions IE6 support, so I think it's a bit outdated.
Source: https://habr.com/ru/post/1729221/More articles:Unable to create GD image resource from BMP with MIME type "image / x-ms-bmp" in PHP - phpScreensaver App Does Not Read App.Config - c #WebLogic load balancing - cluster-computingNetwork Event Capture Event Capture - c ++NERDTree and buffer handling - vimApplication Sharing - mysqlasp.net mvc dynamic / relative routing - asp.net-mvcAttach HTML file as email in VB 6.0 - htmlDataGridView Header Alignment - vb.netHTTP Requests in C # - httpAll Articles