It is isn't it. Struts 1.1 introduced some great features (thanks guys!) -
our Struts 1.0 app had a whole load of customizations including
ActionServlet but with 1.1 they are no longer needed. I love the plugins and
the RequestProcessor and the fact that you can configure it.

On this caching issue - whats peoples opinion of adding the a unique number
to every request - is this a 100% surefire way of preventing caching?

I researched caching on a couple of lists and I found somewhere the
following headers recommended.

   // HTTP/1.1 No Cache Headers
   response.setHeader("Cache-Control", "no-cache, no-store,
must-revalidate")

   // IE Extended HTTP/1.1 No Cache Headers
   response.addHeader("Cache-Control", "post-check=0, pre-check=0")

   // HTTP/1.0 No Cache Headers
   response.setHeader("Pragma", "no-cache")

   // Set expired
   response.setHeader("Expires", "0")

The standard Struts RequestProcessor sets the following headers (if noCache
is configured in the <controller>)

   response.setHeader("Cache-Control", "no-cache")
   response.setHeader("Pragma", "No-cache")
   response.setDateHeader("Expires", "1")

Comments welcome.

Niall

----- Original Message ----- 
From: "Geeta Ramani" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Sunday, March 07, 2004 1:12 AM
Subject: Re: Extending Request Processor to append request parameter


> *Sweet*!!  Thank you, Craig and Niall (got your name right this time,
huh?)...
> Struts gets to be any more fun, the department of homeland security is
gonna
> declare it an act of terrorism..
>
> Geeta
>
> Niall Pemberton wrote:
>
> > Geeta
> >
> > You don't need to subclass ActionServlet - you can set the
RequestProcessor
> > class in the <controller> element in the struts-config.xml
> >
> > <controller processorClass="mypackage.MyRequestProcessor"/>
> >
> > Full details for the configuring the controller are in the user guide:
> >
> > http://jakarta.apache.org/struts/userGuide/configuration.html
> >
> > Niall
> >
> > ----- Original Message -----
> > From: "Geeta Ramani" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Saturday, March 06, 2004 10:15 PM
> > Subject: Re: Extending Request Processor to append request parameter
> >
> > > Brad:
> > >
> > > I looked at the API and noticed the RequestProcessor is a 1.1
feature..
> > Your
> > > solution seems nice and clear!  I only have one question for you
though:
> > How
> > > do you "connect" the subclass of RequestProcessor that you wrote with
the
> > > struts ActionServlet..?  Do you have to subclass the ACtionServlet too
and
> > > then join the dots there? How do you do that?   There is a "
processor"
> > method
> > > in ActionServlet which returns the processor..but I don't see a
> > setProcessor
> > > method..?
> > >
> > > thanks for posting your solution: I learnt something new today..:)
> > > Geeta
> > >
> > > Brad Balmer wrote:
> > >
> > > > Well, I searched through the archives with no luck on
> > > > 'ParameterActionForward' or similar.  I ended up trying to ovveride
the
> > > > ActionForward class but couldn't get it to work well.  Then I
noticed in
> > > > the RequestProcessor there is a doForward() that can be ovveridden.
I
> > > > wrote the following and it seems to work.
> > > >
> > > > Is there a better way/place to do this than the RequestProcessor?
This
> > > > seems like a prettly locical/central place to do this.
> > > >
> > > >     protected void doForward(
> > > >         String path,
> > > >         HttpServletRequest request,
> > > >         HttpServletResponse response)
> > > >         throws IOException, ServletException {
> > > >         super.doForward(addUniqueParameterToURL(path), request,
> > response);
> > > >     }
> > > >
> > > >     private String addUniqueParameterToURL(String url) {
> > > >         if(url == null) {
> > > >             return url;
> > > >         }
> > > >         String newURL =  url
> > > >             + ((url.indexOf("?") == -1) ? "?" : "&")
> > > >             + "uid"
> > > >             + "="
> > > >             + Long.toString(System.currentTimeMillis());
> > > >         return newURL;
> > > >     }
> > > >
> > > > Curtis Taylor wrote:
> > > >
> > > > > Hi Brad,
> > > > >
> > > > > Someone on this list (sorry; can't remember who) subclassed
> > > > > ActionForward to do exactly this. Search the archives for
> > > > > ParameterActionForward.
> > > > >
> > > > > If you can't find it, email me off-list & I'll send you the Java
file
> > > > > (I have it stashed away somewhere.
> > > > >
> > > > > Curtis
> > > > > --
> > > > > c dot tee at verizon dot net
> > > > >
> > > > > Brad Balmer wrote:
> > > > >
> > > > >> I've been looking into this for a while and can't figure out how
to
> > > > >> do this easily.
> > > > >>
> > > > >> I would like to append a unique number to each request in an
attempt
> > > > >> to defeat caching (setting all the normal META tags as well as
the
> > > > >> 'nocache' in the controller doesn't seem to ALWAYS work).
> > > > >>
> > > > >> Therefore I wanted to append a Parameter to each request and add
a
> > > > >> unique number so that the server would not look in the cache.
(Having
> > > > >> the user change their browser caching mechanism isn't an option).
> > > > >>
> > > > >> I see where I can SEE the different request parameters, but where
can
> > > > >> I append a new parameter?  I would like to do this in a central
> > > > >> location.
> > > > >>
> > > > >> Any ideas?  Has anybody else come up with a good way of doing
this?
> > > > >>
> > > > >> Thanks.
> > > > >>
> > > > >>
> > > >
>> ---------------------------------------------------------------------
> > > > >> 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]
> > > >
> > >
> ---------------------------------------------------------------------
> > > > 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]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>



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

Reply via email to