tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Is there a way to get the "docBase" property from within a servlet?
Date Sun, 02 Sep 2001 04:48:10 GMT


On Mon, 27 Aug 2001, Rick Mann wrote:

> Date: Mon, 27 Aug 2001 20:28:17 -0700
> From: Rick Mann <rmann@latencyzero.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Is there a way to get the "docBase" property from within a
>     servlet?
>
> Is there a Servlet spec-compliant way to get the webapp's directory's path
> programmatically, from within a servlet?

No.

> Something like calling
> ServletConfig.getInitParameter("docBase"), but something that's standard,
> and that does not require me to specify the path explicitly in a
> configuration file?
>

You are starting from an incorect assumption, that there *is* such a thing
as a portable "directory path" to a web application.  It is entirely legal
for a servlet container to run a web application directly from a WAR file
(in which case there is no expanded directory), or by storing its static
resources in some other sort of structure (such as being BLOB objects in a
database).

> TIA,
>
> Rick
>
>

Craig McClanahan



Mime
View raw message