Robert,
  I think your second option is the best route. I have used MessageContext
to get a hold of my servlet's context and it works dandy. 

-----Original Message-----
From: Robert Bateman [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 15, 2005 3:01 PM
To: axis-user
Subject: Re: java.rmi.Remote Web Services and getInitParameter

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(HTTPCons
> > tants.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
> > 
> > 

Reply via email to