Hi,
I have a web service with webservicecontext injection. I want to know if this class is thread-safe if I use @Singleton annotation.
@WebService()
@Singleton()
public class Proves {
@Resource
WebServiceContext wsContext;
@WebMethod(operationName = "feralgo")
public String feralgo(@WebParam(name = "parametro1") String parametro1) {
//TODO write your implementation code here:
//Get host and ip client
String nomClient,ipClient;
MessageContext msgContext = wsContext.getMessageContext();
HttpServletRequest srvlRequest = (HttpServletRequest) msgContext.get(MessageContext.SERVLET_REQUEST);
nomClient = srvlRequest.getRemoteHost();
ipClient = srvlRequest.getRemoteAddr();
//Get user authenticated
String usuari;
usuari = wsContext.getUserPrincipal().getName();
return nomClient + " " + ipClient + " " + usuari;
}
}
[Message sent by forum member 'emoya']
http://forums.java.net/jive/thread.jspa?messageID=482159