Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Creation Time

 
Gagan Indus
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

getCreationTime() of HttpSession returns the time of creation of Object in milliseconds
My q is , does web-container creates a HttpSession for first resquest from client regardless of :
- if it is a request for static-resource , like static HTML page , image etc
- if it is a request for dynamic-resource , servlet/jsp page dat is
OR session is ONLY created for first request of dynamic-resource ?

------------------
Gagan (/^_^\) SCJP2
Die-hard JavaMonk -- little Java a day , keeps u going .
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither. A session is created the first time you request it, i.e. calls request.getSession() or request.getSession(true). Note that JSPs use sessions by default, but you can disable this.
In the last public-facing web site I did, we purposefully used 'session="false"' on the opening page to improve the scalability of the server somewhat: we didn't need any sessions for that page, and wanted to avoid creating sessions for users that never click through to the rest of the site.
- Peter
 
Gagan Indus
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankx Peter !
wid ur real-life example , i think i never gonna forget it now ! 10x
------------------
Gagan (/^_^\) SCJP2
Die-hard JavaMonk -- little Java a day , keeps u going .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic