• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session

 
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I was wondering if a session is only specific for a browser. If we open up another browser in the same computer within the session's life time will another session be created?
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Cameron Park:
Hi, I was wondering if a session is only specific for a browser. If we open up another browser in the same computer within the session's life time will another session be created?


If session tracking uses cookies (normally it does), a new session will be started only if the browser is really different (i.e. not a second copy of the very same browser).
If session tracking uses URL rewriting (normally only used when the browser refuses cookies), a new session will be started every time you go into the site.
- Peter
 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<i>If session tracking uses URL rewriting (normally only used when the browser refuses cookies), a new session will be started every time you go into the site.</i>
From the same browser(ie. reload) and different session started every time or only different browser? If same browser, then I don't see "state" persisting throughout session.
 
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A Session is an object that can be associated with a request. This is an implicit object that you get for free in JSP.
Now in order to get the behavior you want you need to understand what the session is really doing behind the scenes. If you understand what is happening then you can write your own mechanisms for tracking sessions.
As mentioned above, the session object is real just setting cookies or rewritting URL's. The default behavior is setting cookies and if that is not available the URL is rewritten.
Your applications behavior will be dependent on the browser. If the browser shares cookies with its other instances then their will only be one active session available using that browser. If you rewrite the URL (in theory you could code a mechanism that will POST the session id instead and get the same results) then the sessions will/can be seperate for each instance of the browser or even for different windows of the same instance of the browser. (I say CAN be different because I could cut and past the session id from one window into another and then have two windows with the same session)
Obviously if you are running two completely different browsers, say netscape and IE, they don't share cookies and you will have two sessions.
I hope this helps.
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using IE, opening a new window with File->New or Control->N will always open a browser with the same internal thread.. ie, the session id will be the same. If you open a new IE browser using the desktop icon, you will get a different id.
For netscape, apparantly, multiple windows use the same internal thread.. So no matter how you open browser windows, all of them will share the same id.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic