Re: Caching a resource on the browser side

2009-08-04 Thread ZedroS Schwart
I finally managed to set the headers this way : WebResponse response = (WebResponse) getRequestCycle().getResponse(); response.setDateHeader(Date, System.currentTimeMillis()); response.setDateHeader(Expires, System.currentTimeMillis() + CACHE_DURATION);

Re: Caching a resource on the browser side

2009-08-04 Thread Erik van Oosten
According to http://code.google.com/speed/page-speed/docs/caching.html you should not set both Expires and Cache-Control: max-age. I suggest you: - also set Cache-control: public (see the article). - get rid of the session cookie when the cvs file is first retrieved. I think the cookie is the

Re: Caching a resource on the browser side

2009-07-28 Thread Juri Prokofiev
To set headers to a resource you need to extend setHeaders method from WebResource. Example: @Override protected void setHeaders(WebResponse response) { super.setHeaders(response); response.setAttachmentHeader(announcements.csv);

Re: Caching a resource on the browser side

2009-07-28 Thread ZedroS Schwart
Thanks for this answer Juri. I tried it (once again) and it didn't work : the setHeaders method isn't called... I use Live HTTP headers to check what goes through : http://localhost:8080/charts/data/dataId/KBU GET /charts/data/dataId/KBU HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0

Re: Caching a resource on the browser side

2009-07-28 Thread Juri Prokofiev
It works for me. ResourceLink csvLink = new ResourceLink(csvLink, new ResourceReference(AnnouncementCsvResource.ID), params); add(csvLink); public class AnnouncementCsvResource extends WebResource { public static final String ID = csv; @Override public IResourceStream

Re: Caching a resource on the browser side

2009-07-28 Thread ZedroS Schwart
hi Juri I did it the same way as you did and it worked fine. Even more : I didn't even see lines in http header (???). However, it doesn't fit my use case : I need to get the link to the file to embed it in a javascript. Previously I did it this way : PageParameters parameters = new

Caching a resource on the browser side

2009-07-27 Thread ZedroS Schwart
hi We need to provide a flash application (www.amcharts.com if anyone is interested) with some content through some files. As the files are users specific (and determined with data from the session), we went for some page delivering the content like this : public AMChartDataProviderPage(final