Hi The only "issue" you may encounter is to call getThreadLocalRequest in another thread ...
On Sat, Nov 29, 2008 at 9:13 AM, ijonas <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm trying to the remeber/store the current user in the HttpSession > object returned by RemoteServiceServlet.getThreadLocalRequest > ().getSession(). Unfortunately > RemoteServiceServlet.getThreadLocalRequest() returns null, causing a > subsequent NPE when I call getSession(). > > public class ClientManagerImpl extends RemoteServiceServlet implements > ClientManager { > > private HttpSession getHttpSession() { > return this.getThreadLocalRequest().getSession(true); > } > > private void rememberLoggedInUser(User loggedInUser) { > HttpSession session = getHttpSession(); > if (session!=null) { > session.setAttribute("currentUser", loggedInUser); > logger.info("session found and currentUser set"); > } else { > logger.error("session not found!"); > } > } > } > > The idea is that the "login method" will call rememberLoggedInUser > (User) and store the user for future calls to the > RemoteServiceServlet. > All this code is being run from a Spring-based WAR on top of JBoss > 4.0.3. > > Are there any known issues with thread local variables or > getThreadLocalRequest() that is causing it to work in some conditions > and not in others ? > > Many thanks, > Ijonas. > > > > -- Si l'ignorance peut servir de consolation, elle n'en est pas moins illusoire. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---