You must use the non-standard header updating mechanism to manipulate
Cache-Control:

Form headers = (Form) response.getAttributes().get("org.restlet.http.headers");
if (headers == null) {
  headers = new Form();
  response.getAttributes().put("org.restlet.http.headers", headers);
}
headers.add("Cache-Control", "no-cache");

This mechanism works fine, but it's kind of verbose -- and you get a
warning from Restlet 1.1, which you can ignore.  There isn't an easy
message.setCacheControl(CacheControl.NO_CACHE) or some such method
built into Restlet yet.

- Rob

On Thu, Mar 19, 2009 at 11:54 AM, martin <[email protected]> wrote:
>
> Hi Rob,
>
> Thanks for your remarks!
>
> I tried to add an attribute "Cache-Control" with value "no-cache" both on the 
> server response and the client request:
>
> // Server
>
> Restlet situation = new Restlet() {
> �...@override
>  public void handle(Request request, Response response) {
>  ...
>  response.setEntity(kml,MediaType.TEXT_XML);
>  Map<String,Object> map = new HashMap<String,Object>();
>  map.put("Cache-Control", "no-store");
>  response.setAttributes(map);
>  }
> };
>
>
> // Client
> ...
> request.setAttributes(map);
>
> But nothing changed!
>
> Please note that I only encountered this problem when running the GWT client 
> from hosted mode. When I browse the same URI through the Firefox navbar, I 
> have no caching problem, and the appropriate document version is displayed.
>
> By the way, what do you mean by "caching is not good in 1.1"? I am actually 
> using this version of restlet and would like to avoid changing version right 
> now :)
>
> Martin

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

Reply via email to