Howdy,
I've posted answers to questions like this in the past, so you can
search the archives if you wish.  In summary:

- Your code needs to reside in the common classloader repository, not
under your webapp
- You probably want to make your webapp privileged (it's a Context
attribute in server.xml)
- Then you crawl down the tomcat container hierarchy, e.g.:
Server server = ServerFactory.getServer();
Service service = server.findService("Catalina");
Container engine = service.getContainer();
Container host = engine.findChild("localhost");
...

I'm using the default names of "Catalina" and "localhost" as the
example.  Your actual arguments should match whatever you define in
server.xml.  The above classes are in the org.apache.catalina package.

As for adding an alias dynamically: you can try re-initializing the
container, but I don't know if it will work, I haven't tried it ;)

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Vincent Gogan [mailto:[EMAIL PROTECTED]
>Sent: Friday, January 23, 2004 10:55 AM
>To: Tomcat Users List
>Subject: How to access Server/Container from a web application (tomcat
4.1)
>
>Could someone please point me at some sample code to
>access the Server/Containers from the web application.
>In particular, I would like to add a host alias dynamically.
>Is this possible without changing server.xml and restarting?
>
>Thanks,
>
>Vincent
>
>
>---------------------------------------------------------------------
>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]

Reply via email to