On Fri, 27 Jun 2003, Josh Rayls wrote:

> Date: Fri, 27 Jun 2003 11:03:15 -0400
> From: Josh Rayls <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: RE: Best way of implementing application-specific config objects
>
> I like to use this method, because I can then use my initalization servlet
> for other sorts of initialization items.  For instance, if you have some
> sort of scheduler in your app, this init servlet can also take care of
> scheduling relevant tasks.  Perhaps you have other services within your web
> app that need to be initialized; this servlet can also handle those items.
> It's not just a way to load your configuration; it's a way to do
> boostrapping sort of items without utilizing the proprietary interfaces of
> your app server.
>
> Don't get me wrong.  I love Struts, but I try to shy away from things that
> tie me down to a certain framework.  That's why I tend to stay away from the
> plugin options.  In my opinion, app configuration is vendor and framework
> neutral.  It should work no matter where you deploy and be independent from
> any frameworks that you choose to implement.
>

If you're using a Servlet 2.3 container, the standardized way to do what
PlugIn does is to use a ServletContextListener.  You register the listener
in web.xml, and its contextInitialized() method gets called when your app
is deployed, and contextDestroyed() gets called when the app is shut down
(so you can clean up resources).  And this will work on any Servlet 2.3+
container (such as Tomcat 4.x and 5.x).

PlugIn is primarily there to give folks using Servlet 2.2 a way to
initialize and finalize resources without having to subclass
ActionServlet.

> -Josh

Craig

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

Reply via email to