tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chris derham <ch...@derham.me.uk>
Subject Re: Getting an absolute path into a servlet's context-param value w/o hardcoding in web.xml
Date Fri, 29 Jul 2011 23:11:53 GMT
>
> As part of the "configuration" of the servlet to be deployed into an
> environment, it wants a directory path passed as a servlet context
> parameter:
>
> (WEB-INF/web.xml)
> ....
>  <context-param>
>    <param-name>3rd-party-app.home</param-name>
>    <param-value>/path/to/directory</param-value>
>  </context-param>
> ....
>
> In our environments, "/path/to/directory" will be different for different
> deployments, and so we don't want to hardcode this into the web.xml else the
> WAR is non-portable.
>
> Put the following on <tomcat_home>/conf/context.xml and it will override
the value in web.xml - override false means should web.xml override this
value, so it has to be false

    <Parameter name="3rd-party-app.home" value="/path/to/other/directory"
override="false"/>

This will set this parameter for all wars in the tomcat instance.
Alternatively you can specify the setting in a per war file via placing it
in <tomcat_home>conf/Catalina/localhost/AppName.xml

Hope that helps

Chris

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message