multiple sessions created
843842Sep 29 2009 — edited Oct 1 2009Hi all,
I have a problem with session creation in my Tomcat server. The client is a Flex application, that generates several concurrent requests to my server.
Problem description:
When the flex application initialize, several requests are sent to my server (get i18n resources, etc), the problem is that because all these requests are sent at the same time, each one generates a new HttpSession in my server. The session id used from that moment on, is the corresponding to the last request received by the container.
I will put an example with 2 requests for you to understand the problem better:
1. Flex app sent the two request to the server (one immediately after the other).
2. When the container executes request.getSession() in the "first" request the new session is created and the corresponding session id is going to be returned as a cookie header.
3. When the "second" request arrives to the container, the "first" has not finished yet, and has not returned to the client with the corresponding session id cookie. Because of this, when request.getSession() is executed in the "second" request a new session is created.
4. The session id that the Flex app continue using is the corresponding to the last request that returns to the client.
Any help would be very appreciated.
Please note, that I would like to remain with the possibility of invoking several simultaneous requests from the client, and not to do some trick in Flex (Eg: put all requests in a synchronous queue)
Thanks in advance!..