struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@gmail.com>
Subject Re: Filters
Date Tue, 29 Mar 2005 19:06:32 GMT
If your filter really wants to do a RequestDispatcher.foward() call
(to go someplace other than the servlet that the original request URI
is mapped to), you can do that too ... you're not stuck with
redirects.  That way you don't lose your request parameters and
attributes.

Craig


On Tue, 29 Mar 2005 14:01:08 -0500 (EST), Frank W. Zammetti
<fzlists@omnytex.com> wrote:
> Yeah, my bad... I cracked open the authorization filter I wrote because I
> didn't want to give a wrong answer off the top of my head... problem is,
> that filter just redirects to a "Go away, your not allowed in here!" kind
> of page, so there was no concern with losing request parameters in that
> use case.  Good call Joe :)  Whether he needs the contents of request of
> not it's a good point to be aware of.
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Tue, March 29, 2005 1:24 pm, Joe Germuska said:
> > Frank's suggestion might work, although note that it would result in
> > the discarding of all request parameters, which may not be what you
> > want.
> >
> > If you have complex session initialization logic in an Action and you
> > want to use it in the Filter, I'd suggest factoring it out into a
> > utility class.  Alternatively, don't try to use the filter to do
> > this: the main reason to use a filter is to apply common logic upon
> > every request (or at least many requests); if you have all this in an
> > Action now, that suggests you only use it once.
> >
> > You could probably also somehow use the Filter to set a request
> > attribute, and then subclass the RequestProcessor to recognize that
> > request attribute as an instruction to invoke your session-prep
> > action -- but that seems way more complicated than you really need.
> >
> > Joe
> >
> >
> > At 12:45 PM -0500 3/29/05, Frank W. Zammetti wrote:
> >>response.sendRedirect(url);
> >>
> >>That's what I do.  You do get a reference to request, so I would assume
> >>you could get a dispatcher off it and do what you always do.  I've never
> >>had a need to try it though.
> >>
> >>--
> >>Frank W. Zammetti
> >>Founder and Chief Software Architect
> >>Omnytex Technologies
> >>http://www.omnytex.com
> >>
> >>On Tue, March 29, 2005 12:40 pm, Denis Avdic said:
> >>>  Hello all,
> >>>
> >>>  Although I've been using Struts for small projects for a while now, I
> >>>  haven't really used filters.  Now I am incorporating some
> >>>  functionality from another project into mine, and the other project
> >>>  used plain old servlets and filters.
> >>>
> >>>  My question is this:
> >>>
> >>>  In filter's doFilter method, is there a way to forward to a Struts
> >>>  action somehow?  I need to populate the session and I have all this
> >>>  stuff already written, I just need to do a forward to the action
> >>>  somehow.  How could I do this without request.getRequestDispatcher()
> >>>  calls?  Or can I do it at all?
> >>>
> >>>
> >>>  I haven't wrote pure servlet in a looooong long while and I forgot a
> >>>  lot of things so please excuse me if my question is dumb.
> >>>
> >>>
> >>>  Thanks,
> >>>
> >>>  Denis
> >>>
> >>>  ---------------------------------------------------------------------
> >>>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>  For additional commands, e-mail: user-help@struts.apache.org
> >>>
> >>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> > --
> > Joe Germuska
> > Joe@Germuska.com
> > http://blog.germuska.com
> > "Narrow minds are weapons made for mass destruction"  -The Ex
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message