tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Setting properties outside of the WAR
Date Tue, 02 Jan 2001 21:10:15 GMT
Ritchie Young wrote:

> Thanks for the response but that wasn't quite what I was getting at.
> The idea was that there should be some easy way for an administrator to set
> a property for the application. It just strikes me that the TOMCAT_OPTIONS
> variable is a slightly cumbersome way especially when there start to be a
> few more applications.
> I thought that the "Context" tag in server.xml wouldn't be a bad place to
> incorporate application specific settings such as where the application can
> find it's properties file. This would also allow for multiple instance of
> the same application to use different configurations but only one WAR file.

The settings in server.xml are designed to configure Tomcat's own features --
not your application.  Your app is responsible for that.  You can do things in a
portable way (for example, call
ServletContext.getResource("/WEB-INF/")), or not, as you

Keep in mind that the intent of web applications is that they are *stand alone*
gadgets, to be dragged and dropped onto a servlet container (*any* container,
not just Tomcat) and work correctly.  Given that, it does not make sense for the
servlet API to provide any mechanism to access resources outside of the WAR.
You are free, of course, to implement any such technique (such as passing the
absolute pathname to a properties file in a servlet initialization parameter),
but you are making it harder on people who want to deploy your webapp in a
variety of environments, as well as limiting the set of environments in which
your app can run (for example, an ISP might prohibit file access in order to
protect the various web apps from each other).

> Cheers
> Ritchie

Craig McClanahan

View raw message