commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver.Heger" <>
Subject Re: Dynamicly adapt Configuration on Redploy
Date Sun, 17 Dec 2006 16:27:18 GMT
Thomas Thomas wrote:
> Hi,
> I am using Jakarta configuration to specify in my web application, an
> absolute path to the images dir.
> This absolute path is different in the test server and in the deployment
> server.
> So when I deploy I need to manually change that path every time ...
> How can I handle this ? Thank u.
One solution could be making use of system properties: You can specify
the location of the images as a property such as myapp.imagedir and pass
it to the JVM in your server start script using the -D option. The value
of this property would differ on the test server and the production server.

Then in your configuration file(s) you can access the property's value.
To do this you have to use a configuration definition file and work with
ConfigurationFactory or DefaultConfigurationBuilder (the user guide
contains information for both of these classes). The definition file
could look something like this:

  <!-- Enable access to system properties -->
  <!-- Include the normal configuration files -->
  <xml fileName="..."/>
  <properties fileName="..."/>

To include the image path property in a configuration file - e.g. in a
properties file - use the following syntax:

imagepath = ${myapp.imagedir}

(I hope that in future versions of Commons Configuration access to
system properties can be simplyfied.)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message