users@glassfish.java.net

Re: system properties in deployment descriptors?

From: <glassfish_at_javadesktop.org>
Date: Fri, 20 Feb 2009 14:29:31 PST

> You could have an env-entry like this in your
> web.xml:
> <env-entry>
>
> env-entry-name>docroot_path</env-entry-name>
>
> env-entry-type>java.lang.String</env-entry-type>
>
> env-entry-value>/usr/local/foo</env-entry-value>
> </env-entry>
>
> And then you add a context.xml with following
> contents:
> <Context>
> <Environment name="docroot_path"
> type="java.lang.String"
> value="/usr/local/bar"/>
> </Context>
>
> You could put the file in
> glassfish/domains/domain1/config/context.xml, but
> note this will be loaded by all web apps.
>
> There is also a way in Tomcat which can define web
> application specific context.xml outside of the
> application, but this support has not been ported
> yet. The ported web application specific context.xml
> support also needs to package context.xml inside the
> web application which does not meet your need.

FYI, v3 b30 or later supports context.xml outside of the application (WAR) so web application specific context.xml can be read from domains/domain1/config/[i]context_path[/i].xml. V3 has two options for webapp specific context.xml - in webapp/META-INF/context.xml for inside WAR and domains/domain1/confic/context_path.xml for outside WAR. Global [i]domains/domain1/config/context.xml[/i] and virtual-server [i]domains/domain1/config/context.xml.default[/i] level context.xml which is shared by all webapps and all webapps under the virtual server respectively are supported in addition to webapp specific context configuration.
[Message sent by forum member 'amyroh' (amyroh)]

http://forums.java.net/jive/thread.jspa?messageID=333195