NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
vu pham Posted via mailing list.
|
Posted: Fri Jun 20, 2008 2:07 pm Post subject: java web service / servlet params |
|
|
I use NB6 to create java web services.I have some parameters set under
<init-param> of the servlet for the web service. How do I get the
ServletConfig instance in order to get those parameters ?
Thanks,
Vu |
|
| Back to top |
|
 |
Johnny Kewl Posted via mailing list.
|
Posted: Sat Jun 21, 2008 8:38 am Post subject: java web service / servlet params |
|
|
----- Original Message -----
From: "vu pham" <vu@sivell.com>
To: <nbusers@netbeans.org>
Sent: Friday, June 20, 2008 3:59 PM
Subject: [nbusers] java web service / servlet params
| Quote: | I use NB6 to create java web services.I have some parameters set under
<init-param> of the servlet for the web service. How do I get the
ServletConfig instance in order to get those parameters ?
Thanks,
|
Vu,
I'm no ws expert,
but I dont think you can, or rather should... the servlet is no longer yours
to mess with, its doing all the marshalling, loading up the class, calling
into it, and then sending back some soap.
If they exposed requests and servlet contexts, then people will mess with
it.
So I think if its not exposed in the WS interface... its because one
shouldnt mess with it.
So, what do you do...
You should be able to set and get params thru JNDI... so
<env-entry>
<env-entry-name>YourVar</env-entry-name>
<env-entry-value>SomethingInteresting</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
in web.xml
and
Context env = (Context) new
InitialContext().lookup("java:comp/env");
String docBase = (String) env.lookup("YourVar");
in the web service... I think will pass your params across.
Then, its an application so, creating a property file, and reading it from
the jar, is also an option.
I'm a little like you, I'd be tempted to get the JAX source, and modify it
so that I could play with servlets as well... but I dont think they want you
to do that and of course if you moved it from say Tomcat to an App
server... then I think messing with servlets directly really wouldnt work.
Good thing about the JNDI approach is that dB pooling uses a similar
method...
Have fun..
---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
--------------------------------------------------------------------------- |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|