OK. Calling it from a method then it works. I thought calling the super() the servlet was already initialized.
Thanks for helping. On 24 Mar, 16:30, Isaac Truett <[email protected]> wrote: > That's because you're calling getThreadLocalRequest() before the > servlet has even been initialized. Call it from a remote service > method instead. > > > > On Tue, Mar 24, 2009 at 10:28 AM, Arturo <[email protected]> wrote: > > > Thanks, > > this was something I wasn't aware of. > > Anyway I've tested to put objects in the Session but the > > getThreadLocalRequest() returns null, when I run it from eclipse in > > Hosted Mode. > > > This is my code: > > > public class SASAdapterServiceImpl > > extends RemoteServiceServlet > > implements SASAdapterService > > { > > final static long serialVersionUID = 1L; > > > public SASAdapterServiceImpl() > > { > > super(); > > System.out.println("\n Thread Local Request : > > "+this.getThreadLocalRequest()); > > > and the result is: > > Thread Local Request : null > > > Any idea ? > > > On 23 Mar, 22:09, obesga <[email protected]> wrote: > >> That's a servlet lifecycle question, a servlet engine ( f.e. Tomcat ) > >> may create one or many instances of a servlet, as needed. At init, one > >> will be created. > >> There's no way to control or configure this; and this behaviour is > >> determined by servlet specification, nor by GWT > > >> If you want to assign some resources /objects to only one session, use > >> this on the servlet code : > > >> getThreadLocalRequest().getSession().setAttribute("resource", > >> resoure); > > >> Oskar > > >> Pd. so much time without posting here.... excuse me ! > > >> On 23 mar, 21:32, Arturo <[email protected]> wrote: > > >> > Hi all, > >> > may be my question sounds a bit strange, but 'cause I'm approaching an > >> > important project implementation I want to be sure I understood GWT > >> > mechanism. > > >> > My problem is the following: > >> > - I've created a GWT application that uses anRPCService for > >> > accessing data from database. > >> > In a single user environment it works fine. > > >> > Than I tested a multiuser access and I started from accessing the > >> > deployed application from two different web browser (Firefox and IE) > >> > at thesametime (approx...) from thesamePC (sameip address). > >> > What I found out is that the Remote Implementation object, that is > >> > subclass of RemoteServiceServlet seems to be thesamefor both web > >> > page ! > >> > If I put the remoteinstanceout (System.out.println(this)) if > >> > discover that is just thesame. Of course this creates a lot of > >> > problems to me. > > >> > Am I missing something or is a normal behaviour because it use a sort > >> > of session context ? > > >> > My worries is what happens when different end-users access to my > >> > application, once deployed ! > > >> > Any help would be appreciated. > > >> > Arturo- Nascondi testo citato > > >> - Mostra testo citato -- Nascondi testo citato > > - Mostra testo citato - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
