As usual, lots of ways to skin that cat. You could just leave it in a separate servlet and have its <load-on-startup> value precede the Struts servlet. You could also use a Struts PlugIn. If you're using a Servlet 2.3 container, you could use a ServletContextListener.

As for the handler object, a Servlet 2.3 container would allow you to use a Filter. Another possibility would be to extend RequestProcessor with a class that implements processPreprocess.

If the setup and request authentication don't depend on any Struts classes, I'd opt for the ServletContextListener and Filter approach.

Wendy Smoak wrote:

I'm converting an existing webapp to Struts.  I have some code in a
Servlet init() method, and I don't immediately see where I should put
it.  This is an authentication/authorization webapp, and the code in
question sets up an authentication handler object to be used by every
subsequent request.

What's guaranteed to get executed before the Action code?  (I'm almost
thinking Filter, and to put the object in Application scope, but I'm not
sure yet.)

Any advice?

-- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/>



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



Reply via email to