You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Robert Bateman <bo...@sequoiallc.com> on 2005/02/15 21:33:33 UTC

java.rmi.Remote Web Services and getInitParameter

I have a doc/lit based web service created by WSDL2Java that implements
java.rmi.Remote.

In my code, I have been asked to remove my hard coding of how I access
our Data Bases services and to load init parameters to look that
information up.

I did a search of the list and found 1 thread from July of 2003 that
talked about the getInitParameter() call.  In that thread, the author
appeared to implement ServiceLifecycle and get access to his context in
the init() method.

2 questions:

1) Can I replace the reference to java.rmi.Remote in my code with
javax.xml.rpc.server.ServiceLifecycle and use the init() method?  I
suspect not as my code is doc/lit, but I am no expert.

2) If I can't do the replacement, is the following code correct for
accessing the init parameters?

HttpServlet servletContext = 
(HttpServlet)MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLET);
String strStaging = servletContaxt.getInitParameter( "MySQL_Staged_ACI"
);


I know that the MySQL_Staged_ACI parameter is defined correctly in my
web.xml as I can load it's value from a JSP page and from a servlet I'm
using as a reference template.

Thanks for your time!

Bob


Re: java.rmi.Remote Web Services and getInitParameter

Posted by Elaine Nance <el...@commerce.state.ak.us>.
Bob,

I rummaged a bit and found this link:
<!--http://jotm.objectweb.org/current/jotm/doc/howto-tomcat-jotm.html-->

It *may* be helpful.

Elaine

Robert Bateman wrote:
> Elaine,
> 
> You are correct - a properties file would be easier to use. 
> Unfortunately, I'm the "contractor" on the project and the "employees"
> are using the web.xml file with different configurations to process the
> same code thru their Testing, QA, Staging and Production environments. 
> They have *lots* of code already written that reads info via the
> getInitParameter() call - so mine needs to match.
> 
> THANKS for the thought though :)
> 
> 
> Bob
> 
> 
> On Tue, 2005-02-15 at 15:55, Elaine Nance wrote:
> 
>>It is easy to use a Whatever.properties file. Import 
>>java.util.Enumeration, java.util.Properties and 
>>java.util.ResourceBundle and use the methods from those.
>>
>>If your db is Oracle, otn has exact code samples in the Java 
>>samples.  Works great.
>>
>>HTH,
>>Elaine
>>
>>Robert Bateman wrote:
>>
>>>I have a doc/lit based web service created by WSDL2Java that implements
>>>java.rmi.Remote.
>>>
>>>In my code, I have been asked to remove my hard coding of how I access
>>>our Data Bases services and to load init parameters to look that
>>>information up.
>>>
>>>I did a search of the list and found 1 thread from July of 2003 that
>>>talked about the getInitParameter() call.  In that thread, the author
>>>appeared to implement ServiceLifecycle and get access to his context in
>>>the init() method.
>>>
>>>2 questions:
>>>
>>>1) Can I replace the reference to java.rmi.Remote in my code with
>>>javax.xml.rpc.server.ServiceLifecycle and use the init() method?  I
>>>suspect not as my code is doc/lit, but I am no expert.
>>>
>>>2) If I can't do the replacement, is the following code correct for
>>>accessing the init parameters?
>>>
>>>HttpServlet servletContext = 
>>>(HttpServlet)MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLET);
>>>String strStaging = servletContaxt.getInitParameter( "MySQL_Staged_ACI"
>>>);
>>>
>>>
>>>I know that the MySQL_Staged_ACI parameter is defined correctly in my
>>>web.xml as I can load it's value from a JSP page and from a servlet I'm
>>>using as a reference template.
>>>
>>>Thanks for your time!
>>>
>>>Bob
>>>
>>>
> 
> 
> 

-- 
<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  |  Computers are useless. They can only give you answers.
  |                                 --  Pablo Picasso  --
<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





Re: java.rmi.Remote Web Services and getInitParameter

Posted by Robert Bateman <bo...@sequoiallc.com>.
Elaine,

You are correct - a properties file would be easier to use. 
Unfortunately, I'm the "contractor" on the project and the "employees"
are using the web.xml file with different configurations to process the
same code thru their Testing, QA, Staging and Production environments. 
They have *lots* of code already written that reads info via the
getInitParameter() call - so mine needs to match.

THANKS for the thought though :)


Bob


On Tue, 2005-02-15 at 15:55, Elaine Nance wrote:
> It is easy to use a Whatever.properties file. Import 
> java.util.Enumeration, java.util.Properties and 
> java.util.ResourceBundle and use the methods from those.
> 
> If your db is Oracle, otn has exact code samples in the Java 
> samples.  Works great.
> 
> HTH,
> Elaine
> 
> Robert Bateman wrote:
> > I have a doc/lit based web service created by WSDL2Java that implements
> > java.rmi.Remote.
> > 
> > In my code, I have been asked to remove my hard coding of how I access
> > our Data Bases services and to load init parameters to look that
> > information up.
> > 
> > I did a search of the list and found 1 thread from July of 2003 that
> > talked about the getInitParameter() call.  In that thread, the author
> > appeared to implement ServiceLifecycle and get access to his context in
> > the init() method.
> > 
> > 2 questions:
> > 
> > 1) Can I replace the reference to java.rmi.Remote in my code with
> > javax.xml.rpc.server.ServiceLifecycle and use the init() method?  I
> > suspect not as my code is doc/lit, but I am no expert.
> > 
> > 2) If I can't do the replacement, is the following code correct for
> > accessing the init parameters?
> > 
> > HttpServlet servletContext = 
> > (HttpServlet)MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLET);
> > String strStaging = servletContaxt.getInitParameter( "MySQL_Staged_ACI"
> > );
> > 
> > 
> > I know that the MySQL_Staged_ACI parameter is defined correctly in my
> > web.xml as I can load it's value from a JSP page and from a servlet I'm
> > using as a reference template.
> > 
> > Thanks for your time!
> > 
> > Bob
> > 
> > 


Re: java.rmi.Remote Web Services and getInitParameter

Posted by Elaine Nance <el...@commerce.state.ak.us>.
It is easy to use a Whatever.properties file. Import 
java.util.Enumeration, java.util.Properties and 
java.util.ResourceBundle and use the methods from those.

If your db is Oracle, otn has exact code samples in the Java 
samples.  Works great.

HTH,
Elaine

Robert Bateman wrote:
> I have a doc/lit based web service created by WSDL2Java that implements
> java.rmi.Remote.
> 
> In my code, I have been asked to remove my hard coding of how I access
> our Data Bases services and to load init parameters to look that
> information up.
> 
> I did a search of the list and found 1 thread from July of 2003 that
> talked about the getInitParameter() call.  In that thread, the author
> appeared to implement ServiceLifecycle and get access to his context in
> the init() method.
> 
> 2 questions:
> 
> 1) Can I replace the reference to java.rmi.Remote in my code with
> javax.xml.rpc.server.ServiceLifecycle and use the init() method?  I
> suspect not as my code is doc/lit, but I am no expert.
> 
> 2) If I can't do the replacement, is the following code correct for
> accessing the init parameters?
> 
> HttpServlet servletContext = 
> (HttpServlet)MessageContext.getCurrentContext().getProperty(HTTPConstants.MC_HTTP_SERVLET);
> String strStaging = servletContaxt.getInitParameter( "MySQL_Staged_ACI"
> );
> 
> 
> I know that the MySQL_Staged_ACI parameter is defined correctly in my
> web.xml as I can load it's value from a JSP page and from a servlet I'm
> using as a reference template.
> 
> Thanks for your time!
> 
> Bob
> 
> 

-- 
<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  |  Computers are useless. They can only give you answers.
  |                                 --  Pablo Picasso  --
<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~