RE: Moving init params from web.xml to context.xml

2011-08-23 Thread Jeffrey Janner
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-nameLOG4J_PROPS/param-name
 param-value/WEB-INF/Log4j.properties/param-value
   /context-param
   servlet
 servlet-nameSERVA/servlet-name
 display-nameSERVA/display-name
 descriptionControlling servlet for A/description
 servlet-classcom.mycompany.webapp.serva/servlet-class
 init-param
   param-nameSERVA_PROPS/param-name
   param-value/WEB-INF/SERVA.properties/param-value
 /init-param
 load-on-startup1/load-on-startup
   /servlet
   servlet
 servlet-nameSERVB/servlet-name
 display-nameSERVB/display-name
 descriptionControlling servlet for B/description
 servlet-classcom.mycompany.webapp.servb/servlet-class
 init-param
   param-nameSERVB_PROPS/param-name
   param-value/WEB-INF/SERVB.properties/param-value
 /init-param
 load-on-startup1/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



Re: Moving init params from web.xml to context.xml

2011-08-23 Thread Mark Shifman


  
  
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-namecompanyName/param-name
  param-valueMy 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-nameLOG4J_PROPS/param-name
param-value/WEB-INF/Log4j.properties/param-value
  /context-param
  servlet
servlet-nameSERVA/servlet-name
display-nameSERVA/display-name
descriptionControlling servlet for A/description
servlet-classcom.mycompany.webapp.serva/servlet-class
init-param
  param-nameSERVA_PROPS/param-name
  param-value/WEB-INF/SERVA.properties/param-value
/init-param
load-on-startup1/load-on-startup
  /servlet
  servlet
servlet-nameSERVB/servlet-name
display-nameSERVB/display-name
descriptionControlling servlet for B/description
servlet-classcom.mycompany.webapp.servb/servlet-class
init-param
  param-nameSERVB_PROPS/param-name
  param-value/WEB-INF/SERVB.properties/param-value
/init-param
load-on-startup1/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, 

Re: Moving init params from web.xml to context.xml

2011-08-23 Thread Marvin Addison
 This is equivalent to the inclusion of the following element in the web 
 application deployment descriptor (/WEB-INF/web.xml):

 context-param
   param-namecompanyName/param-name
   param-valueMy Company, Incorporated/param-value
 /context-param

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

That's correct but there's no way afaik to map a context parameter
onto a servlet init parameter like these mentioned previously:

  servlet
 ...
    init-param
      param-nameSERVA_PROPS/param-name
      param-value/WEB-INF/SERVA.properties/param-value
    /init-param
  /servlet

In my experience the servlet needs to search both context parameters
and init parameters for initialization.

M

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



RE: Moving init params from web.xml to context.xml

2011-08-23 Thread Jeffrey Janner
 -Original Message-
 From: Marvin Addison [mailto:marvin.addi...@gmail.com]
 Sent: Tuesday, August 23, 2011 9:43 AM
 To: Tomcat Users List
 Subject: Re: Moving init params from web.xml to context.xml
 
  This is equivalent to the inclusion of the following element in the
 web application deployment descriptor (/WEB-INF/web.xml):
 
  context-param
param-namecompanyName/param-name
param-valueMy Company, Incorporated/param-value
  /context-param
 
  but does not require modification of the deployment descriptor to
 customize this value.
 
 That's correct but there's no way afaik to map a context parameter
 onto a servlet init parameter like these mentioned previously:
 
   servlet
  ...
     init-param
       param-nameSERVA_PROPS/param-name
       param-value/WEB-INF/SERVA.properties/param-value
     /init-param
   /servlet
 
 In my experience the servlet needs to search both context parameters
 and init parameters for initialization.
 
 M

Thanks Marvin.  That is what I was thinking, the two are separate entities, 
with separate methods of accessing them.  Not being a developer, I wasn't 
positive though.  I can get with the Dev team and see if they are willing to 
re-code for the possibility (or even need to).
__

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



Re: Moving init params from web.xml to context.xml

2011-08-23 Thread Marvin Addison
 I can get with the Dev team and see if they are willing to re-code for the 
 possibility (or even need to).

It's a valuable change that dramatically increases your deployment
options; well worth the effort IMO.

M

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



Re: Moving init params from web.xml to context.xml

2011-08-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jeffrey,

On 8/23/2011 12:38 PM, Jeffrey Janner wrote:
 Thanks Marvin.  That is what I was thinking, the two are separate 
 entities, with separate methods of accessing them.  Not being a 
 developer, I wasn't positive though.  I can get with the Dev team
 and see if they are willing to re-code for the possibility (or even
 need to).

One option is to modify your servlets' base class to override
getInitParameter (and friends) to also search the context parameters.
You could even use a servlet-name prefix for your context-param to
avoid collisions.

If you don't have a servlet base class... you should :)

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5T+ScACgkQ9CaO5/Lv0PCLfQCguxuL2SjVgquZPtZ69zkB6+lA
GbcAn0LHiOTEqvTrTc9T1wuzgOy1SdUF
=S2iG
-END PGP SIGNATURE-

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