Ryan -
Whereever you store them - in the ApplicationResources.properties file,
some other .properties file, in the web.xml file or even hardcoded into a
.java class - make sure you use Ant to build the version you need and not
go in and hand-change the properties when you're creating the war file for
deployment on a specific machine.
One good way to do this is to put platform- or host-specific properties in
a file named "build.properties" and have use the Ant <replace> task read
the properties from this file and then <replace> these values with the ones
for the particular platform.
Expanding Victor's earlier example:
1. In your /WEB-INF/web.xml file, code:
<env-entry>
<description>My variable description</description>
<env-entry-name>myVariable</env-entry-name>
<env-entry-value>#MY_VARIABLE_VALUE#<env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
2. In the build.properties for THIS PARTICULAR TARGET MACHINE have the
entry
my.variable.value=/usr/local/bin/stuff
3. Then in your Ant build.xml file, have a task similar to:
<target name="build-war-for-Server01" >
<replace
file="webapps/myWebApp/WEB-INF/web.xml"
propertyFile="path/to/Server01/build.properties" >
<replacefilter
token="#MY_VARIABLE_VALUE#"
property="my.variable.value"/>
</replace>
</target>
4. The resulting web.xml will then contain the correct environment values,
and you can access them as Victor indicated:
> and from any of your servlet/action classes you can do the following
to
> retrieve the variables:
> Context context = new InitialContext();
> stuff = (String) context.lookup("java:comp/env/myVariable");
A similar approach can be used to create machine-specific
ApplicationResource.properties files.
FWIW -
Kevin
---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure. If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>