• 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

is session different for same user

 
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
session is created when ever a new request is received by the server and maintained till time expires or that request has been closed.

take for example if i am opening n browser for same website URL did that mean n sessions are created and maintained by the user.

since new sessions are created when there is no session object associated with the request, the consequent request from the same user with n no of browser may create n no of sessions

Am i right, correct if i am wrong.
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct in your statement that n browsers = n sessions, however the session is not closed when the request is, but rather when it times out, or is manually invalidated.

Remember a web-app interacts with a user via a series or requests and responses, and the session would be utterly useless if it expired after each response. There would be no state management!
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, it is possible to have more than one browser using the same HttpSession object. It depends on the browser and how it is opened.
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi kieth
can i say on opening the browser for the same website by right clicking the mouse and giving open in new window wont create a new session object the request will proceed with the same session object.../

But when the user is issuing the link by opening a new browser i hope the new session will be created

correct me if i was wrong.
 
Keith Pitty
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It also depends on the browser. Unfortunately I don't have the details at hand but I do know that there are differences in the way different browsers (e.g. IE, Firefox, Safari, Opera) behave with respect to whether or not new HttpSession objects are created when new browser windows are opened.

Perhaps someone else can shed some light on how the different browsers behave.
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From my experience when a request originates from an already existing session in a browser. The session continues, no new session is instatiated as long as the origination of the request is from the same window.

So when yu open a new browser window by right-clicking and opening a new window the session is maintained.

I have tried this with internet explorer and with Mizilla Firefox.
 
Scheepers de Bruin
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct on the opening of a browser from the same window.
I misread the "same" part.
[ September 28, 2005: Message edited by: Scheepers de Bruin ]
 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I feel that there is no need to know, how different browsers behave with respect to sessions. Anyways, as developers we need to write a generic code and container developers should also write a generic code.

Even the servlet specification states that, NEVER assume 1 browser window = 1 session.

They say that Cookies and SSL certificates are all part of the browser process and NOT part of a SINGLE BROWSER.

Specification states that we(developers) should always assume that request from multiple windows can still be part of same session.
 
Parameswaran Thangavel
Ranch Hand
Posts: 485
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
is the session created Automatically i read some where the sessions are created automatically,

but in other notes i found that we need to give the following lines to make the session available for the request

HttpSession session = request.getSession(true);

which one is right....
any one
 
It's exactly the same and completely different as this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic