tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Shilling" <>
Subject RE: Refereing to a Container Attribute in a Nested Container
Date Thu, 19 Feb 2009 17:47:27 GMT
I am setting up Virtual Hosts.  In my server.xml I have entries like

<Server ...>
  <Service ...>
      <Host name="sample1" appBase="SampleApps1" 
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false"/>
      <Host name="sample2" appBase="SampleApps2" 
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false"/>

Each of the Virtual Hosts will have one or more Contexts.  I am concerned about the Context
declaration for my Web Application which is nested in the directory structure under $CATALINA_HOME/conf.

I am setting this up so that each virtual host shares the same document base (i.e., it is
the same application in different contexts).  Each virtual host has a root.xml that looks
something like 

<?xml version='1.0' encoding='utf-8'?>
<Context displayName="sample1" docBase="../SciHealthDocBase" path=""
         <Parameter name="ClientName" value="Doc" override="false"/>
         <Parameter name="AppBase" value="../SampleApps1/" override="false"/>

The getRealPath() method of my ServletContext gives me paths relative to my docBase.  I need
a way to access directories within my appBase so that I can place dynamically created content
within those directories.  I am doing this right now by defining a Context Parameter that
has a relative path hard coded.  Not so bad but I have to make sure I modify this file correctly
for each virtual host setup.

Since the Context declaration is being loaded as part of a Virtual Host I was hoping to be
able to refer to the appBase attribute of the Host entry to make my Context declaration more


2700 Northeast Expressway, Ste C-200
Atlanta, GA 30345

-----Original Message-----
From: André Warnier [] 
Sent: Thursday, February 19, 2009 11:15 AM
To: Tomcat Users List
Subject: Re: Refereing to a Container Attribute in a Nested Container

John Shilling wrote:
> In particular, in my Context element I would like to create a Parameter
> element where the value of the "value" attribute is the "appBase"
> attribute of the Host element containing this Context.
Can you kind of "unwind" that sentence, or provide an example, so that 
we mere mortals would understand what you mean ?

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message