eclipse-ee4j / eclipse-ee4j/jersey
Setting cookies in ContainerResponseContext removes existing cookies in HttpServletResponse
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
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]
Contributor guide
Assessment
This issue has not been assessed yet.