• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sessions and requests

 
Clive Walden
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I hope this is the correct forum for these questions.

1. Do HTTPRequest and xmlHTTPRequests from a users browser page share the same session?

2. If so, can race conditions occur whereby an xmlHTTPRequest can start processing before an HTTPResponse
has returned? i.e. Could one browser tab send an xmlHTTPRequest shopping cart change of item while another tab is processing a HTTPRequest calculating total cost such that we have no way of knowing which items are actually in the calculation.

I hope I am making sense.

Another way of asking:

If I have an object stored in a session with a global variable (pointer) to a request, could a second request to the session overwrite that variable before the first request had finished processing so that the process started requesting parameters that it thought were from the first request but, in fact, were from the second request?

I hope this makes sense. We have database accesses and calculations that can take time (the above was only an example not real world) and with AJAX and tabbed browsers I can see xmlHTTPRequests and HTTPRequests in a single session arriving faster than they are handled.

I do not think I need help in managing that situation. I just need to know if I need to bother.

Thanks,
Clive
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34851
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clive,
Welcome to JavaRanch!

Yes. The user has one HttpSession regardless of whether you are making a regular request or using AJAX. And yes, race conditions can occur.
 
Clive Walden
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Clive,
Welcome to JavaRanch!

Yes. The user has one HttpSession regardless of whether you are making a regular request or using AJAX. And yes, race conditions can occur.

Thanks. It is what I expected but could find nothing sufficiently definitive for my comfort.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic