Mike Dunn wrote:

> Are you not worried about code breaking when container vendors take
> advantage of the spec? We can define something now that will support the
> current spec. I propose replacing servlets such as DatabaseServlet with the
> concept of a "plugin" (hopefully, you can come up with a less overused
> name):
>

Are you thinking that the "plugins" will be plugged into ActionServlet?  If so,
you've still got the same issues as with DatabaseServlet, because the servlet
container is entitled to throw out your ActionServlet instance if it wants to.

In the servlet 2.3 API, there is a new feature called "Application Event
Listeners".  You can register (in web.xml) a particular class as a listener, and
an instance of your class will be called when the application is created, and
when it is destroyed -- completely independent of the lifecycle of the servlets
in that application.

This is perfect for things like initializing and finalizing database
connections, or any other resources that you want to guarantee you have
available for the entire lifetime of your app.  Unfortunately, I cannot (yet)
use them in Struts because it wouldn't be supported in any of the servlet 2.2 /
JSP 1.1 containers out there.

If you want to try this new feature, I suggest you download a recent milestone
release of Tomcat 4.0 (http://jakarta.apache.org), which supports the new APIs.

Craig McClanahan


Reply via email to