Hi,
I'm unable to add a cache-control header to the HTTP response via JaxRS. I've
tried two different approaches without success.
1.
@GET
@Produces("application/json")
public Response get() {
...
CacheControl cc = new CacheControl();
cc.setNoCache(true);
cc.setNoStore(true);
cc.setPrivate(true);
return Response.ok(json).cacheControl(cc).build();
This produces the exception on the server:
org.restlet.ext.jaxrs.internal.todo.NotYetImplementedException
at
org.restlet.ext.jaxrs.internal.spi.CacheControlHeaderDelegate.toString(CacheControlHeaderDelegate.java:84)
at
org.restlet.ext.jaxrs.internal.spi.CacheControlHeaderDelegate.toString(CacheControlHeaderDelegate.java:44)
at javax.ws.rs.core.CacheControl.toString(CacheControl.java:295)
at
org.restlet.ext.jaxrs.internal.util.Util.copyResponseHeaders(Util.java:299)
2. Then I tried just using the header() method on RequestBuilder, but that
failed (no header in the response -- I used tcpdump to verify). I did:
@GET
@Produces("application/json")
public Response get() {
...
return Response.ok(json).header("Cache-Control", "no-cache, no-store,
private").build();
Is there a workaround or something I'm not doing correctly?
Thanks,
Jim
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2389897