eclipse-ee4j / eclipse-ee4j/jersey
Failing to read all "Set-Cookie"-Headers
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
Given the following Response Headers, not all Headers can be accessed using getHeaders()
Response Headers:
```
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Type: application/xml; charset=utf-8
Content-Encoding: gzip
Expires: Thu, 09 Mar 2017 09:43:54 GMT
Last-Modified: Thu, 09 Mar 2017 09:43:54 GMT
Vary: *
Server: Microsoft-IIS/7.5
Set-Cookie: .DWPLATFORMAUTH=; expires=Wed, 08-Mar-2017 09:43:54 GMT; path=/XXX/XXX; HttpOnly
Set-Cookie: .DWPLATFORMAUTH=XXXXX; path=/; HttpOnly
Set-Cookie: DWPLATFORMBROWSERID=; expires=Wed, 08-Mar-2017 09:43:54 GMT; path=/XXX/XXX; HttpOnly
Set-Cookie: DWPLATFORMBROWSERID=YYYY; expires=Fri, 09-Mar-2018 09:43:54 GMT; path=/; HttpOnly
Date: Thu, 09 Mar 2017 09:43:54 GMT
Content-Length: 1739
```
In an implementation of ClientResponseFilter I am trying to access the Set-Cookie-Headers.
```
public void filter(ClientRequestContext request, ClientResponseContext response) throws IOException {
List cookieHeaders = response.getHeaders().get("Set-Cookie"));
}
```
I expect cookieHeaders to contain a list with all four "Set-Cookie"-Headers. However, cookieHeaders contains a list with four empty Strings:
```
response.getHeaders().get("Set-Cookie") => (java.util.LinkedList) [, , , ]
```
I am using HttpUrlConnection and did not set CookieHandler.setDefault(), because I am do not want to share Cookies between different connections to the same hosts.
#### Environment
Using HttpUrlConnection without setting CookieHandler.setDefault()
#### Affected Versions
[2.22.2]
Contributor guide
Assessment
This issue has not been assessed yet.