You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Collins, Jim" <ji...@uk.nomura.com> on 2003/07/01 18:21:36 UTC

Can't get DefaultContext value

Hi,

I am trying to access an environment value that is defined in the server.xml
file like this:

<DefaultContext ...>
  ...
  <Environment name="formatFile" value="/myfile.txt"
         type="java.lang.String" override="true"/>
  ...
</DefaultContext>

In my code I do a lookup like this:

(String)env.lookup("formatFile");

But this fails. If I declare the environment in the context.xml then the
lookup works (or I can have a env-entry in the web.xml file).

What I would really like to do is have a default value in the web.xml or
context.xml file but have the ability to override this in the server.xml
file. I have tried setting override="false" in the context.xml file but it
does not pick up the value in server.xml.

One thing I did notice if after the servlet has initialised and I do another
lookup while servicing a client request the value in server.xml is returned.

If anyone has any ideas how I can override values in web.xml/context.xml
with a value in a DefaultContext in server.xml it would be appreciated.

Regards

Jim.


PLEASE READ: The information contained in this email is confidential
and intended for the named recipient(s) only. If you are not an intended
recipient of this email you must not copy, distribute or take any 
further action in reliance on it and you should delete it and notify the
sender immediately. Email is not a secure method of communication and 
Nomura International plc cannot accept responsibility for the accuracy
or completeness of this message or any attachment(s). Please examine this
email for virus infection, for which Nomura International plc accepts
no responsibility. If verification of this email is sought then please
request a hard copy. Unless otherwise stated any views or opinions
presented are solely those of the author and do not represent those of
Nomura International plc. This email is intended for informational
purposes only and is not a solicitation or offer to buy or sell
securities or related financial instruments. Nomura International plc is
regulated by the Financial Services Authority and is a member of the
London Stock Exchange.



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