tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Servlet deployment without using web.xml?!
Date Fri, 18 Jan 2002 18:00:37 GMT


On Fri, 18 Jan 2002, Thomas Åhlen wrote:

> Date: Fri, 18 Jan 2002 12:09:42 +0100
> From: Thomas Åhlen <thomas@obidobi.net>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: Servlet deployment without using web.xml?!
>
> This is what I want to do:
>
> 1. First I define one servlet(Controller) in the web.xml file
> 2. I want my Controller servlet to be able to add and remove
> servlets(modules) from the application context.
>
> Why? In my system each servlet is a module and I want my modules to be
> pluggable. e.g. possible to add and remove modules(servlets) thru the
> Controller servlet. Today I have to change the web.xml file and reload the
> application every module I add/remove.
>
> Is this possible? I would see no reason to why there couldn't be some
> interface between Tomcat and my servlet that could do this.
>
> Thanks for any suggestions
>

The "add a new servlet dynamically" part of your requirements is exactly
what the invoker servlet inside Tomcat does (/servlet/*) the first time it
sees a new request.  This requires a privileged servlet that has direct
access to the internals of Tomcat, so any solution you create based on
this will not be portable.

The "remove an existing servlet dynamically" part is much harder, because
Java provides no mechanism to remove existing classes -- the only choice
is to throw away an entire class loader.  You might look at how JSP page
compilers deal with this (they create a class loader per page), but again
you'd be off on your own with a highly customized Tomcat-specific
solution.

If you really want pluggable modules, you should consider making your
modules webapps in their own right.  Tomcat already does everything you
need for that.

  http://jakarta.apache.org/tomcat/tomcat-4.0-doc/manager-howto.html

> Thomas Åhlen
>

Craig


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message