You could implement ServiceLifecycle and store the value as an init param in
your web.xml file.
import javax.xml.namespace.QName;
import javax.xml.rpc.server.ServletEndpointContext;
import javax.xml.rpc.server.ServiceLifecycle;
import javax.xml.rpc.ServiceException;
import javax.servlet.ServletContext;
public class myService implements ServiceLifecycle{
private String location;
/**
* Required by interface, ServiceLifecycle.
*/
public void init(Object context) throws ServiceException {
ServletEndpointContext ctx = (ServletEndpointContext)context;
ServletContext servletContext = ctx.getServletContext();
this.location = (String)servletContext.getInitParameter("location");
}
/**
* Required by interface ServiceLifecycle.
*/
public void destroy(){}
}
This is working for me with Tomat/Apache on both Windows and Linux.
On Monday 15 December 2003 03:59 am, Guillermo Arias del Rio wrote:
> hi,
>
> I want to set a parameter for my server (where a configuration file is). I
> haven't found any way to provide a parameter to the servlet constructor via
> wsdd. I'm trying to achieve this with an environment variable, but it seems
> not to work (and it is system-dependent)... Is there any way to tell Axis
> to run the constructor of my servlet with a parameter?
>
> I'm developing in Linux with Axis-Tomcat. The code I'm using to get the
> environment is:
>
> private static java.util.Properties getEnvironment() throws IOException {
> java.util.Properties env = new java.util.Properties();
> env.load(Runtime.getRuntime().exec("env").getInputStream());
> return env;
> }
>
> Thanks
--
Ben Souther
F.W. Davison & Company, Inc.