avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kerry Todyruik" <ke...@todyruik.com>
Subject Applying Avalon in a Servlet Environment
Date Tue, 11 Dec 2001 23:37:50 GMT
I've seen a few responses to how to implement Avalon in a servlet
environmet and the typical answer is to check out Cocoon.  Cocoon seems
to implement the main container only in one servlet.  What I needed to
do is make my main application container available to all of my servlets
in my application and have it properly started and shut down with the
Tomcat servlet engine.  I think this is more generic and might be a more
common requirement.

The approach I took was instead of having my main container residing in
one servlet, I made it a singleton.  Then I created an InitServlet as I
saw somewhere for initizlizing Log4j and set this to load at startup by
including it in the webapps web.xml file.  Just like Cocoon, I made the
InitServlet's init() and destroy() methods create and dispose of my main
container.

So the end result is the life of my main container then gets tied to the
starting and stopping of my tomcat server and all of my servlets can
access it.  Seems to work pretty well.

Any comments on this method?  I can post some code if there is any
interest.

Regards,
Kerry Todyruik


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message