[ 
https://issues.apache.org/jira/browse/WINK-317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gerhard Petracek closed WINK-317.
---------------------------------

    
> HttpHeadersImpl.getCookies() only ever returns the first cookie in the Cookie 
> header
> ------------------------------------------------------------------------------------
>
>                 Key: WINK-317
>                 URL: https://issues.apache.org/jira/browse/WINK-317
>             Project: Wink
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 1.1.1
>            Reporter: Chris Francuz
>            Assignee: Bryant Luk
>            Priority: Minor
>             Fix For: 1.1.2
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> org.apache.wink.server.internal.contexts.HttpHeadersImpl.getCookies() 
> iterates over cookie headers but does not iterate over cookies within the 
> header that are split by a semicolon. \\
> \\
> As a result, only 1 cookie is ever returned. This affects using the 
> javax.ws.rs.core.HttpHeaders interface, as well as the 
> javax.ws.rs.CookieParam annotation.\\
> \\
> The fix would be to split the cookie header on the semicolon character, as 
> per [RFC 2965|http://www.apps.ietf.org/rfc/rfc2965.html].  A fix 
> implementation would be:
> \\
> \\
> {noformat} 
>     public Map<String, Cookie> getCookies() {
>         if (cookies == null) {
>             cookies = new HashMap<String, Cookie>();
>             List<String> cookiesHeaders = headers.get(HttpHeaders.COOKIE);
>             if (cookiesHeaders != null) {
>                 for (String cookieHeader : cookiesHeaders) {
>                 if (cookieHeader != null){
>                     for (String cookieText : split(cookieHeader, ';')){
>                         Cookie cookie = Cookie.valueOf(cookieText);
>                         if (cookie != null){
>                             cookies.put(cookie.getName(), cookie);
>                         }
>                     }
>                 }
>                 }
>             }
>         }
>         return cookies;
>     }
> {noformat}  
> (using org.apache.commons.lang.StringUtils.split() )

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to