You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Paul M <pj...@yahoo.com> on 2009/05/08 15:27:14 UTC

Parameter value based on server

Hi

I want a parameter such as the following:
    <Parameter name="companyName" value="My Company, Incorporated"
        override="false"/>
to have different values on different tomcat servers. Say 3 applications on 2 different tomcat boxes, all of which will use element companyName. However, companyName will be different on the two boxes.

I thought of putting this in the context.xml or web.xml file.
However, my understanding is that these files are used by Servlets only?
I have a "helper class" that will need different name,value pairs on different boxes.
What solutions are available? What solutions should I investigate?



      

RE: Parameter value based on server

Posted by Martin Gainty <mg...@hotmail.com>.
along that recommendation an axis2 examples 

web.xml
<web-app>
    <servlet>
        <servlet-name>AxisServlet</servlet-name>
        <display-name>Apache-Axis Servlet</display-name>
        <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
        <param-name>axis2.xml.path</param-name>


then axis2.xml uses parameter
<axisconfig name="AxisJava2.0">
    <parameter name="hotdeployment">true</parameter>

HTH
Martin Gainty 
______________________________________________ 
Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> To: users@tomcat.apache.org
> From: wbarker@wilshire.com
> Subject: Re: Parameter value based on server
> Date: Fri, 8 May 2009 19:18:18 -0700
> 
> 
> "Paul M" <pj...@yahoo.com> wrote in message 
> news:402632.36770.qm@web44811.mail.sp1.yahoo.com...
> >Hi
> >
> >I want a parameter such as the following:
> ><Parameter name="companyName" value="My Company, Incorporated"
> >override="false"/>
> 
> If you set a system property via -DcompanyName="My Company, Incorporated", 
> then you can do:
>    <Parameter name="companyName"  value="${companyName}" override="false" />
> Tomcat will expand the ${companyName} to the value of the system property 
> when it parses the xml file.  And, no, the property name doesn't have to be 
> the same as the Parameter name.
> 
> This is a Tomcat feature, but since you are putting it in a Tomcat 
> configuration file, I'm going to guess that that won't bother you.
> 
> 
> >to have different values on different tomcat servers. Say 3 applications on 
> >2 different tomcat boxes, all of which will use >element companyName. 
> >However, companyName will be different on the two boxes.
> >
> >I thought of putting this in the context.xml or web.xml file.
> >However, my understanding is that these files are used by Servlets only?
> >I have a "helper class" that will need different name,value pairs on 
> >different boxes.
> >What solutions are available? What solutions should I investigate?
> >
> >
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

_________________________________________________________________
Hotmail® has a new way to see what's up with your friends.
http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009

Re: Parameter value based on server

Posted by Bill Barker <wb...@wilshire.com>.
"Paul M" <pj...@yahoo.com> wrote in message 
news:402632.36770.qm@web44811.mail.sp1.yahoo.com...
>Hi
>
>I want a parameter such as the following:
><Parameter name="companyName" value="My Company, Incorporated"
>override="false"/>

If you set a system property via -DcompanyName="My Company, Incorporated", 
then you can do:
   <Parameter name="companyName"  value="${companyName}" override="false" />
Tomcat will expand the ${companyName} to the value of the system property 
when it parses the xml file.  And, no, the property name doesn't have to be 
the same as the Parameter name.

This is a Tomcat feature, but since you are putting it in a Tomcat 
configuration file, I'm going to guess that that won't bother you.


>to have different values on different tomcat servers. Say 3 applications on 
>2 different tomcat boxes, all of which will use >element companyName. 
>However, companyName will be different on the two boxes.
>
>I thought of putting this in the context.xml or web.xml file.
>However, my understanding is that these files are used by Servlets only?
>I have a "helper class" that will need different name,value pairs on 
>different boxes.
>What solutions are available? What solutions should I investigate?
>
>
>




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


RE: Parameter value based on server

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Paul M [mailto:pjmaip@yahoo.com]
> Subject: Parameter value based on server
> 
> I thought of putting this in the context.xml or web.xml file.
> However, my understanding is that these files are used by Servlets
> only?

They're available to any code that has access to ServletContext, which means pretty much any code you have in the webapp.

> What solutions are available? What solutions should I investigate?

If the values are global for all webapps in a given Tomcat instance, you could set an environment variable or Java system property to hold the name, and retrieve it via System.getenv() or System.getProperty(), respectively.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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