Hi Martin,

DeploymentDescriptor is simply a bean that holds the web.xml info we want
to add on the fly , its not a Tomcat class.

basically it holds the init params, servlet name/class and servlet
mapping...those were the only aspects of web.xml we wanted to add on the
fly.

Similarly WebAppConfiguration is another bean that contains application
context root, repository information etc.

Ram

PS: As Mark suggested I am stepping thro the Tomcat code usingremote
debugging in Eclipse...will post more info if i can find out what exactly
I am missing in the Tomcat 5.5 case



>
> thank you for the code send
> i see deploymentDescriptor as a string attribute of mbean
> org.apache.catalina.core.StandardContext
> I also see com.sun.xml.rpc.tools.wsdeploy.DeploymentDescriptorParser class
> but I am unable to locate the javadoc documentation for
> DeploymentDescriptor
> could you display link for DeploymentDescriptor
>
> thanks,
> Martin
> ______________________________________________
> Disclaimer and confidentiality note
> Everything in this e-mail and any attachments relates to the official
> business of Sender. This transmission is of a confidential nature and
> Sender does not endorse distribution to any party other than intended
> recipient. Sender does not necessarily endorse content contained within
> this transmission.
>
>
>> Date: Sat, 4 Oct 2008 23:12:11 -0600
>> Subject: Re: adding servlet definition to context on the fly :Tomcat 5.5
>> From: [EMAIL PROTECTED]
>> To: users@tomcat.apache.org
>>
>> Hi Johnny,
>>
>> Th code i used is basically the one you have in your last email...
>> I have an app running in privileged mode, and it has to add a servlet
>> definition on the fly to another app...so in my app i call a method and
>> pass the description of the other application as well as the servlet
>> definition i want to add:
>>
>> public void addServlet(WebAppConfiguration webApp, DeploymentDescriptor
>> descriptor) {
>>     org.apache.catalina.Server server = ServerFactory.getServer();
>>     String contextRoot = webApp.getContextRoot();
>>     Service[] services = server.findServices();
>>     Context context = null;
>>     String initParamName = descriptor.getInitParamName();
>>     String initParamValue = descriptor.getInitParamValue();
>>     String servletName = descriptor.getServletName();
>>     String servletClass = descriptor.getServletClass();
>>
>>     for (int i = 0; i < services.length; i++) {
>>       Engine engine = (Engine) services[i].getContainer();
>>       Host host = (Host) engine.findChild(engine.getDefaultHost());
>>       context = (Context) host.findChild(contextRoot);
>>       if (context != null){
>>         break;
>>       }
>>     }
>>     if (context == null)
>>       return;
>>     StandardWrapper
>>     w = (StandardWrapper)context.createWrapper();
>>       w.setName(servletName);
>>       w.setServletName(servletName);
>>
>>       w.setServletClass(servletClass);
>>       w.addInitParameter(initParamName, initParamValue);
>>       context.addChild(w);
>>       context.addServletMapping(descriptor.getUrlPattern(),
>> servletName);
>>   }
>>
>>
>> >
>> > ----- Original Message -----
>> > From: "Johnny Kewl" <[EMAIL PROTECTED]>
>> > To: "Tomcat Users List" <users@tomcat.apache.org>
>> > Sent: Sunday, October 05, 2008 5:40 AM
>> > Subject: Re: adding servlet definition to context on the fly :Tomcat
>> 5.5
>> >
>> >
>> >>
>> >> ----- Original Message -----
>> >> From: "Martin Gainty" <[EMAIL PROTECTED]>
>> >> To: "Tomcat Users List" <users@tomcat.apache.org>
>> >> Sent: Saturday, October 04, 2008 11:39 PM
>> >> Subject: RE: adding servlet definition to context on the fly :Tomcat
>> 5.5
>> >>
>> >>
>> >>
>> >> doctor john
>> >>
>> >> to followup with the addChild method and if an exception is thrown
>> and
>> >> you
>> >> determine your container doesnt support child containers..what then?
>> >>
>> >> your diagnosis doctor..
>> >>
>> >> Martin
>> >> ---------------------------------------
>> >> I dont know the history... too young to remember TC 4 ;)
>> >> He probably lost his call when filters or something like that was
>> >> introduced... but heres the coders explanation, perhaps it makes
>> sense
>> >> to
>> >> you...
>> >> I just looked at what he was calling before... and its gone ;)
>> >> addChild is still functional in container... but in wrapper its an
>> >> exception... some history here somewhere... risk one takes if they
>> work
>> >> outside the intended API... unless that is in the servlet spec...
>> doubt
>> >> it...
>> >>
>> >> /**
>> >> * A <b>Wrapper</b> is a Container that represents an individual
>> servlet
>> >> * definition from the deployment descriptor of the web application.
>> It
>> >> * provides a convenient mechanism to use Interceptors that see every
>> >> single
>> >> * request to the servlet represented by this definition.
>> >> * <p>
>> >> * Implementations of Wrapper are responsible for managing the servlet
>> >> life
>> >> * cycle for their underlying servlet class, including calling init()
>> and
>> >> * destroy() at appropriate times, as well as respecting the existence
>> of
>> >> * the SingleThreadModel declaration on the servlet class itself.
>> >> * <p>
>> >> * The parent Container attached to a Wrapper will generally be an
>> >> * implementation of Context, representing the servlet context (and
>> >> * therefore the web application) within which this servlet executes.
>> >> * <p>
>> >> * Child Containers are not allowed on Wrapper implementations, so the
>> >> * <code>addChild()</code> method should throw an
>> >> * <code>IllegalArgumentException</code>.
>> >> *
>> >> * @author Craig R. McClanahan
>> >> * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200
>> (mar.,
>> >> 24
>> >> oct. 2006) $
>> >> */
>> >>
>> >> --------------------.
>> >
>> > A little more homework... would actuall be much easier if we saw the
>> > code...
>> > but the only thing that I can find in TC that is doing more or less
>> what
>> > he
>> > "may" be doing is in the invoker servlet...
>> >
>> > looks like this....
>> >                     wrapper = context.createWrapper();
>> >                     wrapper.setName(name);
>> >                     wrapper.setLoadOnStartup(1);
>> >                     wrapper.setServletClass(servletClass);
>> >                     context.addChild(wrapper);
>> >                     context.addServletMapping(pattern, name);
>> >
>> > So if is calling  addChild on StandardWrapper... he has no chance..
>> > If his calls look something like the above... then its possible that
>> > invoker
>> > servlet is active on TC 4 and its not on TC 5...
>> > Possibly he has to turn on invoker servlet?
>> >
>> > In either case... its open heart surgery that I dont even see in
>> embedded
>> > TC....
>> >
>> > Ram if you dont come right... post your code can we can see for sure
>> what
>> > you doing... we as curious as hell ;)
>> >
>> > ---------------------------------------------------------------------------
>> > 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]
>> >
>> >
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> _________________________________________________________________
> Get more out of the Web. Learn 10 hidden secrets of Windows Live.
> http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008



---------------------------------------------------------------------
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