Gabriel,

I am not certain of how S2 reacts with the settings, but I think that you need something like:
"Cache-Control: max-age=0"

To tell it to 'expire' that page. I used this once in a pure servlet app, and found some reference to it here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.2.3
- section 13.2.5

I am not sure if that helps, but thought I would share what I did.

Thanks,
Brian Trzupek


On Jul 26, 2007, at 1:34 PM, Gabriel Belingueres wrote:

Hi,

Which is the best (right?) way of setting the HTTP headers in a S2 app
to prevent the browser to cache the result pages?

I'm testing right now with a servlet filter which match all /* URLs
but the back button is still working (i.e. the previous page is stored
in the browser cache).

Here is the filter code:

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

   HttpServletResponse res = (HttpServletResponse) response;

   res.setHeader("Cache-Control", "no-cache");
   res.setHeader("Pragma", "no-cache");
   res.addDateHeader("Expires", 0);

   chain.doFilter(request, response);
 }

Am I doing something wrong?

It is best to implement it as a servlet filter? or as an interceptor?
any other way?

TIA,
Gabriel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to