RE: other ways to register a Servlet web application

2004-08-02 Thread Shapira, Yoav

Hi,
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 urlPattern)
{
Server server = ServerFactory.getServer();
Service service = server.findServices()[0];
Engine engine = (Engine) service.getContainer();
Host host = (Host) engine.findChildren()[0];
Context context = (Context) host.findChild("mywebapp");
Wrapper wrapper = 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 the
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:[EMAIL PROTECTED]
>Sent: Sunday, August 01, 2004 2:15 AM
>To: [EMAIL PROTECTED]
>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-
>[EMAIL PROTECTED]/msg132857.html),
>Yoav, would you have a code example?
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



RE: other ways to register a Servlet web application

2004-07-31 Thread Robert Hunt
Regarding this thread and another I just inquired about
(http://www.mail-archive.com/[EMAIL PROTECTED]/msg132857.html),
Yoav, would you have a code example?


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



RE: other ways to register a Servlet web application

2004-07-30 Thread Shapira, Yoav

Hi,
Most servers expose proprietary code to do this.  Tomcat does, for
example: you'd start with ServerFactory.getServer to get the Server
object.  Then crawl down the hierarchy (Service, Engine, Host, Context)
to the webapp you want.  Then use the StandardContext#addWrapper and
related methods to add your servlet.

Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>Sent: Friday, July 30, 2004 3:31 PM
>To: [EMAIL PROTECTED]
>Subject: RE: other ways to register a Servlet web application
>
>Hi!
>
>Yes, sorry, it must be Friday :-)
>
>meant to say ... " register a Servlet in a web application"
>
>"Anyone know of a way to register a Servlet in a web application other
than
>through the web.xml deployment descriptor?"
>
>
>
>
>
>-Original Message-
>From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
>Sent: Friday, July 30, 2004 1:27 PM
>To: Tomcat Users List
>Subject: RE: other ways to register a Servlet web application
>
>
>
>Hi,
>The web.xml deployment descriptor doesn't really register a web
>application.  The registration method is server-specific.  For Tomcat,
>it's dropping the app or its WAR into an appBase directory, or placing
a
>Context declaration for the app in the appropriate configuration
>directory, e.g. conf/[engine]/[host]/ for Tomcat 5.
>
>Yoav Shapira
>Millennium Research Informatics
>
>
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>Sent: Friday, July 30, 2004 12:31 PM
>>To: [EMAIL PROTECTED]
>>Subject: other ways to register a Servlet web application
>>
>>
>>
>>Anyone know of a way to register a Servlet web application other than
>>through the web.xml deployment descriptor?
>>
>>Thank you -
>>
>>Bill
>>
>>-
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>This e-mail, including any attachments, is a confidential business
>communication, and may contain information that is confidential,
>proprietary and/or privileged.  This e-mail is intended only for the
>individual(s) to whom it is addressed, and may not be saved, copied,
>printed, disclosed or used by anyone else.  If you are not the(an)
intended
>recipient, please immediately delete this e-mail from your computer
system
>and notify the sender.  Thank you.
>
>
>-
>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]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



RE: other ways to register a Servlet web application

2004-07-30 Thread bill
Hi!

Yes, sorry, it must be Friday :-)

meant to say ... " register a Servlet in a web application" 

"Anyone know of a way to register a Servlet in a web application other than through 
the web.xml deployment descriptor?"





-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED]
Sent: Friday, July 30, 2004 1:27 PM
To: Tomcat Users List
Subject: RE: other ways to register a Servlet web application



Hi,
The web.xml deployment descriptor doesn't really register a web
application.  The registration method is server-specific.  For Tomcat,
it's dropping the app or its WAR into an appBase directory, or placing a
Context declaration for the app in the appropriate configuration
directory, e.g. conf/[engine]/[host]/ for Tomcat 5.

Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>Sent: Friday, July 30, 2004 12:31 PM
>To: [EMAIL PROTECTED]
>Subject: other ways to register a Servlet web application
>
>
>
>Anyone know of a way to register a Servlet web application other than
>through the web.xml deployment descriptor?
>
>Thank you -
>
>Bill
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



RE: other ways to register a Servlet web application

2004-07-30 Thread Shapira, Yoav

Hi,
The web.xml deployment descriptor doesn't really register a web
application.  The registration method is server-specific.  For Tomcat,
it's dropping the app or its WAR into an appBase directory, or placing a
Context declaration for the app in the appropriate configuration
directory, e.g. conf/[engine]/[host]/ for Tomcat 5.

Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>Sent: Friday, July 30, 2004 12:31 PM
>To: [EMAIL PROTECTED]
>Subject: other ways to register a Servlet web application
>
>
>
>Anyone know of a way to register a Servlet web application other than
>through the web.xml deployment descriptor?
>
>Thank you -
>
>Bill
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



other ways to register a Servlet web application

2004-07-30 Thread bill


Anyone know of a way to register a Servlet web application other than through the 
web.xml deployment descriptor?

Thank you - 

Bill

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