"André Warnier" <a...@ice-sa.com> wrote in message 
news:498ad66a.4080...@ice-sa.com...
> Mikolaj Rydzewski wrote:
>> André Warnier wrote:
>>> if I have a webapp consistig of just a couple of classes and a 
>>> WEB-INF/web.xml config file, but this web.xml file contains some 
>>> parameters that are "each-client-dependent", and some customers are 
>>> insisting to receive the updates as a war file, how can I achieve that ?
>>>
>>> Someone earlier here mentioned that you could put the settings in a file 
>>> outside the application, but that is not possible in this case, or is it 
>>> ?
>> You can have web.xml parameter, e.g.
>>
>> <context-param>
>>    <param-name>config-file-location</param-name>
>>    <param-value>/filesystem/path or URL or 
>> some-other-location</param-value>
>> </context-param>
>>
>> And then you can retrieve parameter value, thus, read config file.
>> Idea is, that param-value is the same for every client/build. E.g. points 
>> to configuration file in $CATALINA_HOME/conf. So you can have one war 
>> file and client dependant configurations.
>>
>>
> Ok, that would work if you wrote the webapp yourself, and all the filters 
> that go with it.  It would however not work if there are some 
> customer-specific parameters in web.xml, that are outside of your control. 
> (I'm thinking for example of a UrlRewrite or jCIFS filter)
>
> Would there be a way to create a war file that does not contain a 
> WEB-INF/web.xml file, but maybe contains a "soft link" to a whole web.xml 
> file located somewhere else ?
>
> The basic idea is : I could still give my customer a war-file that he can 
> deploy containing my updated classes of jars or whatever, but it would not 
> overwrite his customer-specific web.xml when he deploys it.
>
> I think this issue is so general/generic that there must exist some way, 
> no ?

This is totally Tomcat specific, so won't necessarily port if you decide to 
change containers (but without looking probably still works for GlassFish 
and JBoss).  Tomcat does Ant style variable replacement when parsing web.xml 
(both the one in conf and the one in WEB-INF).  So something like

 <context-param>
    <param-name>config-file-location</param-name>
    <param-value>${my.config.file.location}</param-value>
 </context-param>

will work if the System property my.config.file.location is set by the 
startup script/Windows service manager.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to