Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Single session, two applications?  RSS feed

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys! Would it be possible to create a single session shared by two web applications? Thanks!
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Timothy Sam:
Hi guys! Would it be possible to create a single session shared by two web applications? Thanks!


I don't think so (without any trick). The widest scope you have is context and that too is limited to application.

How it is, store something specific to session (user) into any third thing (say DB, accessible to both the application) and then do some logic in both the application´┐Ż just a vague idea.



[ September 27, 2006: Message edited by: rathi ji ]
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose you are navigating a web site that has a HTTPSession at the server end.In that case if you right click and open a link in a new browser.In that case the session is also transfered to the new browser and you can continue navigating the site using session alive in both the browser instances.Actually HTTPSession are nothing but objects at the server and server traks sessions using JSESSIONID which traverses to and fro from browser to server everytime.

When you create a new window (the way i have mentioned above) the JSESSIONID also get copied into the new browser and the new browser also sends that in the header for every request .In this case you have single session shared by two clients.(THAT IS WHY SESSIONS ARE NOT THREADSAFE)
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, sessions are per application.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
per application , per request thread (user).
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rahul Bhattacharjee:
per application , per request thread (user).


No, not per request or request thread.
A session can span multiple requests.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:


No, not per request or request thread.
A session can span multiple requests.


;-) Probably the way I am writing in the post is not very clear(will improve on this).I also mean the same thing.Per request (not HTTP request)I mean one set of user interatcion with servlet, which is tracked using the JSESSIONID(which traverses using the cookie header from browser to servlet).
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rahul Bhattacharjee:


;-) Probably the way I am writing in the post is not very clear(will improve on this).I also mean the same thing.Per request (not HTTP request)I mean one set of user interatcion with servlet, which is tracked using the JSESSIONID(which traverses using the cookie header from browser to servlet).


I get the sense that you understand the issue completely.
I just wanted to clarify, for newcomers, that a new session is not created for each request.
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your answers gentlemen. I am actually aware of the fact that only a single session can be used by a single application(per request). I just became doubtful when I got involved in a project where two applications are made about to be made to communicate with each other... Thank you for your inputs!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!