Hello,
Guadalupe Ortiz wrote:
> I have a web service developed with jaxrpc. I can deploy it anywhere. Can
> the web service know at run time where it has been deployed? Because I can
> even deploy it, the same service, in two different uris, can it distinguish
> in which uri its operations are invoked??
Well, I wonder what difference it makes where the service is running but
you can find out the ContextName via the ServletEndpointContext which is
available through the ServletLifecycle:
public class MyServiceImpl implements MyService, ServiceLifecycle {
private ServletEndpointContext sec;
[...]
public void myRemoteMethod(){
String contextName =
sec.getServletContext().getServletContextName();
[...]
}
public void destroy() {
}
public void init(Object arg0) throws ServiceException {
sec = (ServletEndpointContext)arg0;
}
}
For the name of the virtual host under which this service is deployed
you might want to check the servlet container attributes which can be
accessed via the ServletContext as well.
regards...Andy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net