-
Bug
-
Resolution: Done
-
Major
-
7.0.1.GA, 7.0.4.CR1, 7.1.0.DR3
-
None
Backport RESTEASY-1476
Resteasy does not set Expires attribute correctly when testing the following JAX-RS application using javax.ws.rs.core.NewCookie to set Expires attribute to current date:
@GET @Path("get0") public Response get0() { System.out.println("MyEndpoint get0 - Version 0 Cookie"); NewCookie cookie = new NewCookie("Name", "Value", "/", "*", 0, "comment", 3600, new Date(), true, true); return Response.ok().cookie(cookie).entity(cookie.toString()).build(); } @GET @Path("get1") public Response get1() { System.out.println("MyEndpoint get1 - Version 1 Cookie"); NewCookie cookie = new NewCookie("Name", "Value", "/", "*", 1, "comment", 3600, new Date(), true, true); return Response.ok().cookie(cookie).entity(cookie.toString()).build(); }
V0 Cookie set Expires attribute but it's not same to a specified time (current date). It looks calculated from Max-Age attribute:
$ curl -v localhost:8080/myapp/rest/get0
> GET /myapp/rs/get0 HTTP/1.1
> ...
>
< HTTP/1.1 200 OK
< ...
< Set-Cookie: Name=Value; path=/; domain=*; secure; HttpOnly; Max-Age=3600; Expires=Mon, 22-Aug-2016 01:12:52 GMT
< ...
< Date: Mon, 22 Aug 2016 00:12:52 GMT
<
Name=Value;Version=0;Comment=comment;Domain=*;Path=/;Max-Age=3600;Expires=Mon, 22-Aug-2016 00:12:52 GMT;Secure;HttpOnly
V1 Cookie does not set Expires attribute:
$ curl -v localhost:8080/myapp/rest/get1
> GET /myapp/rs/get1 HTTP/1.1
> ...
>
< HTTP/1.1 200 OK
< ...
< Set-Cookie: Name=Value; Version=1; Path=/; Domain=*; Secure; HttpOnly; Max-Age=3600
< ...
< Date: Mon, 22 Aug 2016 00:12:55 GMT
<
Name=Value;Version=1;Comment=comment;Domain=*;Path=/;Max-Age=3600;Expires=Mon, 22-Aug-2016 00:12:55 GMT;Secure;HttpOnly
- is cloned by
-
JBEAP-5845 [GSS](7.1.0) Resteasy does not set Expires attribute for NewCookie correctly
- Verified
- is incorporated by
-
JBEAP-7525 [GSS](7.0.z) Upgrade Resteasy 3.0.19.Final to 3.0.19.SP1
- Closed
- relates to
-
RESTEASY-1498 (3.0.x) Expires attribute for NewCookie is not set correctly in response header
- Resolved