Hi Jim,

sorry for the late reply, I was on holiday for two weeks.
Cache control is not implemented for now in Restlet API, so JAX-RS 
doesn't support it for now by the API (the first error you have seen).
The second failure I don't understand. Thierry or Jerome, do you have 
any idea?

best regards
   Stephan

Jim Stabile schrieb:
> 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
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2394934

Reply via email to