Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 16307 invoked from network); 2 Aug 2004 13:48:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Aug 2004 13:48:46 -0000 Received: (qmail 72267 invoked by uid 500); 2 Aug 2004 13:48:11 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 72127 invoked by uid 500); 2 Aug 2004 13:48:10 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 72015 invoked by uid 99); 2 Aug 2004 13:48:08 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [63.244.250.133] (HELO warhawk.mpi.com) (63.244.250.133) by apache.org (qpsmtpd/0.27.1) with ESMTP; Mon, 02 Aug 2004 06:48:05 -0700 Received: from thunderbolt.mpi.com (thunderbolt [63.244.253.70]) by warhawk.mpi.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i72Dm2uH023649 for ; Mon, 2 Aug 2004 09:48:02 -0400 (EDT) Received: from US-VS1.corp.mpi.com (us-be2.corp.mpi.com [63.244.252.32]) by thunderbolt.mpi.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i72Dl2u5003552 for ; Mon, 2 Aug 2004 09:47:52 -0400 (EDT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: other ways to register a Servlet web application Date: Mon, 2 Aug 2004 09:47:57 -0400 Message-ID: <9C5166762F311146951505C6790A9CF801FC38D9@US-VS1.corp.mpi.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: other ways to register a Servlet web application Thread-Index: AcR3jzOQ6JB9+3jGT+2Xm2t1EtWmwgBBlWqQ From: "Shapira, Yoav" To: "Tomcat Users List" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N H= i, I'll get you started, in my email editor and without even trying to compile this out of laziness: (But it should be very close) import org.apache.catalina.Context; import org.apache.catalina.Engine; import org.apache.catalina.Host; import org.apache.catalina.Server; import org.apache.catalina.ServerFactory; import org.apache.catalina.Service; import org.apache.catalina.Wrapper; public class NotPortable { public static void addServlet(Class myServletClass, String urlPatter= n) { Server server =3D ServerFactory.getServer(); Service service =3D server.findServices()[0]; Engine engine =3D (Engine) service.getContainer(); Host host =3D (Host) engine.findChildren()[0]; Context context =3D (Context) host.findChild("mywebapp"); Wrapper wrapper =3D context.createWrapper(); wrapper.setServletClass(myServletClass); wrapper.addMapping(urlPattern); wrapper.load(); context.addChild(wrapper); // Optionally context.addServletMapping } A production-quality implementation would not hard-code the name of th= e webapp, nor would it hard-code the 1st service and 1st host (index [0]= in the above code). It might also pass init parameters, etc, but this= just an example to give you an idea. Yoav Shapira Millennium Research Informatics >-----Original Message----- >From: Robert Hunt [mailto:robert-hunt@comcast.net] >Sent: Sunday, August 01, 2004 2:15 AM >To: tomcat-user@jakarta.apache.org >Subject: RE: other ways to register a Servlet web application > >Regarding this thread and another I just inquired about >(http://www.mail-archive.com/tomcat- >user@jakarta.apache.org/msg132857.html), >Yoav, would you have a code example? > > >---------------------------------------------------------------------= >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org This e-mail, including any attachments, is a confidential business com= munication, and may contain information that is confidential, propriet= ary and/or privileged. This e-mail is intended only for the individua= l(s) to whom it is addressed, and may not be saved, copied, printed, d= isclosed or used by anyone else. If you are not the(an) intended reci= pient, please immediately delete this e-mail from your computer system= and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org