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.
[Message sent by forum member 'hzhang_jn' (hzhang_jn)]
http://forums.java.net/jive/thread.jspa?messageID=331322