Reputation: 5406
Like the title says:
I have a Swing standalone client which connects to an EJB application deployed on GF 3.0.1. I'd like to have access to client IP inside EJB methods.
Is this possible?
I also found this thread but the solution was for JBoss...
Upvotes: 1
Views: 1717
Reputation: 2858
@WebService()
public class Test {
@Resource
WebServiceContext context;
@WebMethod(operationName = "getInfo")
public String getInfo() {
HttpServletRequest request = (HttpServletRequest)context.getMessageContext()
.get(MessageContext.SERVLET_REQUEST);
return "IP: " + request.getRemoteAddr() +
", Port: " + request.getRemotePort() +
", Host: " + request.getRemoteHost();
}
}
Upvotes: 1