Writing multiple cookies to Java HTTP Response (HttpSlingServletResponse) not working
I am trying to write multiple cookies to a SlingHttpServletResponse, however only the last cookie i write is visible in the browser.
Ex. response.addCookie(new Cookie("foo", "bar")); response.addCookie(new Cookie("lion", "bear")); response.addCookie(new Cookie("cat", "dog"));
When I look at the cookies on my browser, the only cookie i see is the开发者_运维问答: "cat", "dog" cookie If i switch the order, the last cookie is always the one that displays (so i dont think its something with a specific cookie).
The Java API indicates that you can call response.addCookie() any number of times to add any number of cookies.
Im not sure if this is a Sling specific issue (i dont think it would be) but it might be?
Looking at the code, I suspect this is an issue of the underlying servlet container used.
By default Sling uses the Jetty 6 Container contained in the Apache Felix Http Bundle.
精彩评论