----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Saturday, October 04, 2008 5:34 PM
Subject: adding servlet definition to context on the fly :Tomcat 5.5


Hi,
I had written some code to dynamically add a servlet to a context in a
deployed applicaiton in Tomcat 4.1. This code basically uses the catalina
loader to obtain the server->engine->host->and context, and invokes the
addChild method after configuring a StandardWwrapper to represent the
servlet I am adding. This all works fine in Tomcat4.1 and I am able to
access the servlet through the right url immediately, without having to
restart Tomcat.

I'd luv to see that code... the stuff you playing with is in Tomcat core... must have been difficult to debug... perhaps its an embedded app?

But I think this answers your question...

   public void addChild(Container child) {

       throw new IllegalStateException
           (sm.getString("standardWrapper.notChild"));

   }

is what addChild now looks like in 6... if they did allow it, now they dont (;

Dont think you can blame TC... whoever made that app was doing open heart surgery ;)

I've never tried this, but its really interesting... I think I would start by having a good look at...

HttpServlet source code... its an abstract class with a little introspection...

but I (think... maybe) that the way to go is to make a servlet... that does what HttpServlet servlet does... and then load your sevlet classes into your servlet... and call them...

I (think... maybe) maybe that it will come down to doing your own servlet mapping... and detection of new classes added... possibly your own uri to a "manager" function...

ie I think you can make a servlet intelligent enough to do this... without climbing into the engine and doing a liver transplant... and then because you now inside the official API... this will never happen again.

In the end it will be something like http://domain/contect/addons/ANY_ADD_ON_SERVLETS

... I'd give that a bash... dont think its a good idea trying the current method even if you do find an open vein ;)

Good Luck...

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to