Christopher,

Well after I added that entry, I realized I don't have access to any context
information/classes since this is just a plain JAX-WS web service and not a
web application, so it is not using the JSP/JSR technologies.  That is my
understanding anyway.  So my question is, if that is the case, and I want to
use those context-params, how *DO* I access it from my code.

You mention env-entry as well, but I have not used JNDI and am not really
sure what it even does. I have read about it and seen lots of applied
examples to other app servers/stacks/toolkits.  But I can't seem to locate a
resource that shows how to use JNDI in a tomcat container web service to
access an env-entry in my WEB-INF/web.xml.

Any pointers to the right resources or samples would be great, but if they
don't exist, some advice is also greatly appreciated.

Thanks,

Chris
-----Original Message-----
From: Christopher Schultz [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 29, 2008 5:15 AM
To: Tomcat Users List
Subject: Re: accessing web.xml

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris,

Chris Richmond wrote:
| I have created a web service using JAX-WS and deployed my .war and it runs
| fine, but now I want to convert some hard-coded config values to read
values
| from the WEB-INF/web.xml file that was created/deployed.

Sounds good.

| I have addes something like the following to my web.xml:
|
|     <context-param>
|         <description>test context param</description>
|         <param-name>testParam</param-name>
|         <param-value>my value</param-value>
|     </context-param>

Rest assured... this is a reasonable choice for configuring your webapp.
There is a thread on this list right now where some folks are arguing
over how best to do this (see thread "Best practice? configuration of a
web application"). <context-params> in web.xml is as good as any method IMO.

| And I want to access it from any of my classes within my web service.

Okay. What have you tried? What container objects do you have access to?
Can you get to the request?

| Perhaps I shouldn't be using <context-param> at all, but some other
type of
| entry in web.xml?  In either case, I can't seem to figure out how to
locate
| and use an entry like that from within any class in my JAX-WS web
service.

You could use <env-entry> instead, and then those settings would be
available via JNDI (which you can get to from anywhere) instead of
through the ServletContext (which you might not have available).

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

iEYEARECAAYFAkg+yGMACgkQ9CaO5/Lv0PArpQCglc5w9UVy9XcqOBzjZVeD5pvm
/ngAnijcF+3cMHQPsgsW8rXGQyghjxdT
=TBt0
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to