Setting cookies in ContainerResponseContext removes existing cookies in HttpServletResponse
Looks like if cookie is added using ContainerResponseContext it removes all cookies already added directly HttpServletResponse.
If we create new session using HttpServletRequest.getSession(), it should add Set-Cookie header to HttpServletResponse, which it does. However I have a ContainerResponseFilter which may beed to add some cookies. If I add cookie using
containerResponseContext.getHeaders().add(HttpHeaders.SET_COOKIE, new NewCookie(...));
, the Set-Cookie header for session cookie in HttpServletResponse is never sent to client.
I'm not sure if that's the proper way add cookies in Jersey, but at least the behaviour seems a bit strange.
Affected Versions
[2.22.1]
- Issue Imported From: https://github.com/jersey/jersey/issues/3282
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @mpotociar
@glassfishrobot Commented Reported by kheleniu
@glassfishrobot Commented This issue was imported from java.net JIRA JERSEY-3010
Any update on this? It's something we run into every now and then and it's a bit of a pain to deal with.