Hi,
do you have multiple Cookie headers or a single Cookie containing multiple
values :
Cookie: a=b,c=d
I can see a test confirming HttpHeaders.getCookies() returns a map containing
two entries.
Can you post a sample Cookie value I can add a test for ?
thanks, Sergey
The problem parsing multiple the header when having multiple cookies seems
to be present also when injecting the HttpHeaders headers.
headers.getCookies() returns only one cookie.
Is there any Jira issue tracking this?
Thanks,
V.
On Thu, Jan 14, 2010 at 5:35 PM, Michael Guyver <[email protected]>wrote:
2010/1/14 Sergey Beryozkin <[email protected]>:
> Hi
>
> One can write either a CXF interceptor or CXF JAXRS RequestHandler
filter,
> please see
>
http://cxf.apache.org/docs/jax-rs.html#JAX-RS-DifferencebetweenJAXRSfiltersandCXFinterceptors
>
> If you do JAX-RS only then writing a filter could be a simpler option,
for
> ex, one can have JAXRS HttpHeaders injected into a custom filter :
>
> @Context
> private HttpHeaders headers;
>
> and then just do header.getCookies() in handleRequest();
>
> Alternatively, if you prefer to write a CXF interceptor then you can get
to
> the cookies like this :
>
> String rawValue = new MetadataMap<String, String>(
>
> (Map<String,
> List<String>>)message.get(Message.PROTOCOL_HEADERS)).getFirst("Cookie");
>
> Cookie c = Cookie.valueOf(rawValue);
>
> Note that the CXF HTTP transport does not split multiple header values
> (those separated by ',') so if the Cookie header contains multiple
cookies
> then you'd need to split thme first before doing
Cookie.valueOf(rawValue);
>
> hope it helps, Sergey
>
Hi Sergey,
That's great, thanks very much for your help!
Cheers
Michael