tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: Refereing to a Container Attribute in a Nested Container
Date Thu, 19 Feb 2009 18:05:46 GMT
> From: John Shilling []
> Subject: RE: Refereing to a Container Attribute in a Nested Container
> Each virtual host has a root.xml

That better be ROOT.xml, not root.xml, if you want Tomcat to treat it as the default webapp
for the <Host>; case matters.

> <Context displayName="sample1" docBase="../SciHealthDocBase" path=""

Assuming you're running in a reasonably recent version of Tomcat (you didn't bother to tell
us), there's no displayName attribute for <Context>, nor are the docBase and path attributes
allowed here.  The docBase attribute should only be used when the webapp is deployed outside
of Tomcat's directory structure.

> The getRealPath() method of my ServletContext gives me paths
> relative to my docBase.

It's never a good idea to use getRealPath(), since the container is under no obligation to
return anything useful.

> 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 robust.

I'm not aware of any mechanism of retrieving higher-level container attributes.  As an alternative,
consider using system properties for each host/webapp combination; these can be specified
during Tomcat startup, and can be referenced in <Parameter> elements via ${[]}.

 - Chuck

for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.

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

View raw message