If you are using a Servlet 2.3 compliant application server, you could write
a filter that does this automatically for you and apply the filter to the
action servlet.

-----Original Message-----
From: Antony Stace [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, April 04, 2002 6:07 PM
To: Struts Users Mailing List
Subject: Re: Preventing Caching of all pages

Thanks for the reply.  I want to try this out.  But first a couple of
questions.

I have not extended ActionServlet in my webapp, so I want to ask some advice
on
how to do this and how to adjust the web.xml file.
In regards to extending ActionServlet do I something like

public final class  MyActionServlet extends ActionServlet 
{


}

is the only only function I have to override the perform() method?
Also, once I have done this, do I change my web.xml file so the line

 <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

becomes

 <servlet-class>org.apache.struts.action.MyActionServlet</servlet-class>

Is there any examples anywhere which has in it an extended ActionServlet?

Thanks for your help.

Cheers

Tony



> Regardless, we solve this problem by overriding the process method of
> the ActionServlet and setting some headers prior to calling super.
> Something like this:
> 
>     protected void process(HttpServletRequest request,
>                            HttpServletResponse response)
>         throws java.io.IOException, ServletException
>     {
>         // We're dynamic, so caching is disabled
>         response.setHeader("Cache-Control", "no-cache");
>         response.setHeader("Pragma", "no-cache");
>         response.setHeader("Expires", "-1");
> 
>         super.process(request, response);
>     }
> 

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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



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

Reply via email to