Forums Register Login

Session Creation Time

+Pie Number of slices to send: Send

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 .
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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 .
Never trust an airline that limits their passengers to one carry on iguana. Put this tiny ad in your shoe:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1114 times.
Similar Threads
Request-time Inclusion of dynamic content- Doubt
Runtime Expression Value in jsp:forward
About the Session
JSP - Why does this work?
attributes and listener hfsj question 10
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:51:19.