You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniel Steinberg <Da...@gale.com> on 2002/02/13 22:25:03 UTC

Using Struts with filters

I would like to put my authorization logic in a servlet filter.  If
authorization fails, I would like to display an error page by forwarding to
a JSP.  I would like to look up this JSP name just as I would while
performing a Struts action.  

Unfortunately, the forward mappings (ActionForwards) are attached to the
ActionServlet, and the filter knows nothing about the servlet.  It seems
that my best bet at this point is to override ActionServlet.initOther() and
attach the ActionForwards object to the servlet context.  My filter
(assuming that the servlet has already been loaded) can then get the servlet
context from the filter config and can get the ActionForwards from there.

Does anyone have any better ideas?  Would it make sense, in a future of
revision of Struts, to attach automatically attach all of the configuration
information to the servlet context, so that it will be available to filters
and listeners?

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>