Using an interceptor is a better idea. Otherwise every result will have to be modified to set the headers.
This way, you can just apply the interceptor to any actions that you want to specify a cache policy. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Bernard Choi > Sent: Saturday, 4 October 2003 3:32 AM > To: [EMAIL PROTECTED] > Subject: Re: [OS-webwork] No Cache result... > > > Design questions... > > Should this noCache be in an Interceptor in the first place ? > > Should it be in a Result ? i.e. NoCacheVelocityResult ? > > Are results "interceptorable" ? > > ----- Original Message ----- > From: "Cameron Braid" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, October 03, 2003 8:34 PM > Subject: RE: [OS-webwork] No Cache result... > > > > Headers need to be set before the response is committed. > (ie started > > to be sent to the client) since they get added to the start of the > > http response, before the body. > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On > > > Behalf Of Bernard Choi > > > Sent: Friday, 3 October 2003 9:25 PM > > > To: [EMAIL PROTECTED] > > > Subject: [OS-webwork] No Cache result... > > > > > > > > > Greetings all, > > > > > > managed to get it work, but not sure why. > > > > > > The fix was as follows : > > > > > > public String intercept(ActionInvocation invocation) > > > throws Exception { > > > HttpServletResponse response = > > > ServletActionContext.getResponse(); > > > response.addHeader("expires", "-1"); > > > response.addHeader("pragma", "no-cache"); > > > response.addHeader("cache-control", "no-store, > > > no-cache, must-revalidate"); > > > > > > String result = invocation.invoke(); > > > > > > return result; > > > } > > > > > > By setting the response BEFORE the invokation. No idea why though. > > > > > > > > > >Greetings all, > > > > > > > >Just to check, is there something special about the way WW2 > > > handles the > > > >httpResponses ? > > > > > > > >I have a need to disable the cacheing for a number of pages, > > > and thus, > > > >an interceptor was written to set the relevant headers in the > > > >httpResponse. > > > > > > > > public String intercept(ActionInvocation invocation) > > > throws Exception { > > > > String result = invocation.invoke(); > > > > > > > > HttpServletResponse response = > > > ServletActionContext.getResponse(); > > > > response.addHeader("expires", "-1"); > > > > response.addHeader("pragma", "no-cache"); > > > > response.addHeader("cache-control", "no-store, > > > no-cache, > > > >must-revalidate"); > > > > > > > > return result; > > > > } > > > > > > > >I see that the response is indeed being set, but by the time > > > it reaches > > > the > > > >browser, the results are still being cached. > > > > > > > >Just to check , is this the proper way to handle the response ? > > > > > > > > > > > > > > > >------------------------------------------------------- > > > >This sf.net email is sponsored by:ThinkGeek > > > >Welcome to geek heaven. > > > >http://thinkgeek.com/sf > > > _______________________________________________ > > > >Opensymphony-webwork mailing list > > > >[EMAIL PROTECTED] > > > >https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > > > > > > > > > ------------------------------------------------------- > > > This sf.net email is sponsored by:ThinkGeek > > > Welcome to geek heaven. > > > http://thinkgeek.com/sf > > > _______________________________________________ > > > Opensymphony-webwork mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > > > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Opensymphony-webwork mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork