We use SUN Jersey client to consume some REST services and Apache CXF to
serve some REST services, in the same java project. Some of the services we
consume return cookies with "Expires" directive set. For eg: Set-Cookie:
name=value; Expires=Wed, 09 Jun 2021 10:18:14 GMT.

Consider the below code, assuming wr is a Jersey WebResource. ClientResponse
is also a Jersey class.

ClientResponse resp = wr.get(ClientResponse.class);
System.out.println(resp.getCookies())

Now, in the case of cookies with expires directive, the actual cookie is not
returned. Instead, the expires directive itself is returned as the cookie
(cookie's name is Expires, value is the date).

After some digging, we found that this might be due to the way the
Set-Cookie HTTP header is parsed by CXF in the fromString method of
org.apache.cxf.jaxrs.impl.NewCookieHeaderProvider. Basically, the code seems
to handle "Expires" like a normal cookie and not as a special
directive/metadata (it treats Max-Age and other directives correctly).

Please help us solve this. Are we doing something wrong?

--
View this message in context: 
http://cxf.547215.n5.nabble.com/Cookies-with-expires-directive-tp5649065p5649065.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to