I try to get session information during the first invocation of my RPC Service.
public class MyServiceImpl extends RemoteServiceServlet implements
MyService {
public MyServiceImpl() {
HttpServletRequest req = getThreadLocalRequest();
// req = null here
}
}
Client side, I make a simple call :
MyServiceAsync service = GWT.create(MyService.class);
Is there a alternative solution to get the HttpServletRequest during the first RPC invocation ?
Thank you.
You are calling
getThreadLocalRequest()in the constructor of the servlet which is only called once on servlet initialisation. At that time the request is not yest available.You need to override the
processCall(String)method which is called on every RPC invocation.