Embedded Tomcat with no war or webapps

2004-07-20 Thread Michael Banks

I have successfully embedded Tomcat 5 into an application,
but I would like to be able to load servlets without using
a .war file or a webapps directory and no web.xml file.

In Jetty I can do the following:

ServletHolder holder = handler.addServlet(
MYSERVLET, /myservlet/*, MyServlet.class.getName() );
holder.setInitParameter( ParameterA, /usr/local/dir );
holder.setInitParameter( ParameterB, 42 );

Is there any way to do the same with Tomcat?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Embedded Tomcat with no war or webapps

2004-07-20 Thread Shapira, Yoav
Hi,
Yeah, you'd use StandardContext#createWrapper, set the class on the
Wrapper object, and StandardContext#addServletMapping.  There might also
be a JMX way to do this.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Michael Banks [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 20, 2004 10:16 AM
To: [EMAIL PROTECTED]
Subject: Embedded Tomcat with no war or webapps


I have successfully embedded Tomcat 5 into an application,
but I would like to be able to load servlets without using
a .war file or a webapps directory and no web.xml file.

In Jetty I can do the following:

ServletHolder holder = handler.addServlet(
MYSERVLET, /myservlet/*, MyServlet.class.getName() );
holder.setInitParameter( ParameterA, /usr/local/dir );
holder.setInitParameter( ParameterB, 42 );

Is there any way to do the same with Tomcat?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]