On Tue, Dec 11, 2001 at 04:37:50PM -0700, Kerry Todyruik wrote: > 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.
Sounds good :) I'd have thought that using Avalon in a servlet environment is *the* most common usage. With all the IoC in the Servlet API, Avalon seems a natural fit for writing more complex servlets.. Code would be interesting, even if it's not a working example. Maybe it could form the core of a "Avalon-in-a-servlet-environment starter kit", reusing all those cool things from Cocoon, like env abstraction, protocol handlers, error handling, profiling.. --Jeff > Regards, > Kerry Todyruik > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>