I think the problem here is specific to the "long polling" case mixed with RPC.

If the first call that requests a Session is in the long polling method, while 
the second call (to 
the other method) occurs before the "long polling method" has completed: the 
browser won't have 
received the Session ID cookie from the first request (since it hasn't returned 
yet).

You could test this by using
HttpSession.isNew()
in each of the Servlet methods to see if both requests have created their own 
session.

Putting a "dummy" request for a session into a Servlet or JSP when the host 
page is served 
establishes the session with the client, since the page content will have a 
Cookie header containing 
the Session ID the browser needs to send to all the RPC methods.

It's not the client code setting the Cookie, but rather the Servlet Container 
setting the session ID 
with the client so that the client will request that Session in subsequent 
invocations.

Hope that explains my thinking a bit better.
//J

djd wrote:
> 
> So just making a dummy call is enough? i.e. 2 method calls one after
> the other (in client code) will result in different IDs? More, since
> this mechanism is sevlet specific, client code shouldn't set any
> cookies, by hand at least.
> 
> 
> On Mar 16, 9:10 am, Jason Morris <[email protected]> wrote:
>> Hi Markus,
>>
>> Is it possible the SessionId Cookie hasn't been sent to the client when the 
>> second method is
>> invoked? You may need to force the Server to create the HttpSession object 
>> and send the Cookie in
>> your host page (or before you reach it).
>>
>> Basically any call to HttpServletRequest.getSession() should create the 
>> session and assign an ID to
>> it, but until the response has been sent to the client, the browser won't 
>> have knowledge of that
>> Session.
>>
>> Let me know if thats not the problem.
>> //J
>>
>> Markus wrote:
>>> Hello
>>> I have following problem with my application.
>>> If I make generally rpc calls during RemoteServiceServlet all is fine,
>>> if I use: this.getThreadLocalRequest().getSession().getId() I allways
>>> get the same sessionID back
>>> and I can work with it.
>>> No I have following case. I added a long polling mechanism to get
>>> actual data from the server.
>>> Exactly I have a RemoteServiceServlet which is waiting for data.
>>> Now the problem:
>>> If I make another rpc call to another RemoteServiceServlet, during the
>>> long polling servlet is running,
>>> I get on that second Servlet, a new sessionID if I do
>>> this.getThreadLocalRequest().getSession().getId().
>>> How can it be, that I get 2 different sessionIDs with the same
>>> application?
> > 
> 

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to