Hi,

you can create a class that inherits from Directory and override the handle(Request, Response) method. If the response is successfull (response.getStatus().isSuccess()), then you can set the cache-control header just as Stephan said.

Best regards,
Thierry Boileau

Hi,

the cache control is not supported in the API now. So you have to add it yourself for now.
I propose to create a Filter which sets the value by
response.getAttributes().get("org.restlet.http.headers").put("Cache-Control", youFormattedCacheControlString);
But perhaps others have a better idea.

best regards
  Stephan

Ludovic chaplin schrieb:
Hello,

I'm using Restlet for serving some static files (img, xsl, css...).
I put all this files in a directory resource :
final Directory root = new Directory(this.getContext(), STATIC_FILE_URI);
    router.attach("/", root);

I would like to add cache control http headers like Expires, Last-Modified... Is there a way to add http header for this files like with the apache mod_header?

Thank you,
Ludovic



Reply via email to