from tomcat configuration docs http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

You can configure named values that will be made visible to the web application as servlet context initialization parameters by nesting <Parameter> elements inside this element. For example, you can create an initialization parameter like this:

<Context>
  ...
  <Parameter name="companyName" value="My Company, Incorporated"
         override="false"/>
  ...
</Context>

This is equivalent to the inclusion of the following element in the web application deployment descriptor (/WEB-INF/web.xml):


    

<context-param>
  <param-name>companyName</param-name>
  <param-value>My Company, Incorporated</param-value>
</context-param>

but does not require modification of the deployment descriptor to customize this value.



On 08/23/2011 09:45 AM, Jeffrey Janner wrote:
If it helps generate a reply, I'm deploying into Tomcat 6.0.3x running under JDK 1.6.0_2x.

-----Original Message-----
From: Jeffrey Janner [mailto:jeffrey.jan...@polydyne.com]
Sent: Monday, August 22, 2011 3:12 PM
To: 'Tomcat Users List'
Subject: Moving init params from web.xml to context.xml

Our apps are currently deployed using a minimal context.xml file
(pointer to doc-base only), with all the other information contained in
the web.xml and some properties files. What I'd like to do is move as
much of the customizable values out of the web.xml file and into the
context.xml file to make upgrades a bit easier.  Specifically, I want
to move the properties files to a location that won't get overridden
when new war files are deployed.
Our current web.xml file is structured:
<web-app>
  <context-param>
    <param-name>LOG4J_PROPS</param-name>
    <param-value>/WEB-INF/Log4j.properties</param-value>
  </context-param>
  <servlet>
    <servlet-name>SERVA</servlet-name>
    <display-name>SERVA</display-name>
    <description>Controlling servlet for A</description>
    <servlet-class>com.mycompany.webapp.serva</servlet-class>
    <init-param>
      <param-name>SERVA_PROPS</param-name>
      <param-value>/WEB-INF/SERVA.properties</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet>
    <servlet-name>SERVB</servlet-name>
    <display-name>SERVB</display-name>
    <description>Controlling servlet for B</description>
    <servlet-class>com.mycompany.webapp.servb</servlet-class>
    <init-param>
      <param-name>SERVB_PROPS</param-name>
      <param-value>/WEB-INF/SERVB.properties</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
....
</web-app>

I know from the docs that I can save move the LOG4J_PROPS to the
context.xml as it is defined as a <context-param>.  However, can I move
the 2 servlet props to the context.xml file also?  If so, is it the
same as the log4j, or do I need to do something different?
Lastly, can the <session-timeout> setting be located outside of the
web.xml file?  We customer with different requirements for this value
(some misguided), and would like to make it easy for them to set it
without having to update it with every deployment.

Jeff
_______________________________________________________________________
___

Confidentiality Notice:  This Transmission (including any attachments)
may contain information that is privileged, confidential, and exempt
from disclosure under applicable law.  If the reader of this message is
not the intended recipient you are hereby notified that any
dissemination, distribution, or copying of this communication is
strictly prohibited.

If you have received this transmission in error, please immediately
reply to the sender or telephone (512) 343-9100 and delete this
transmission from your system.
__________________________________________________________________________

Confidentiality Notice:  This Transmission (including any attachments) may contain information that is privileged, confidential, and exempt from disclosure under applicable law.  If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited.  

If you have received this transmission in error, please immediately reply to the sender or telephone (512) 343-9100 and delete this transmission from your system.


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


-- 
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 mark.shif...@yale.edu

Reply via email to