I'm currently writing a thesis where a part of it should be some theory about Java EE 5, Servlets, JSPs and some related things. My question now concerns sessions (server side sessions, web sessions or what ever they should be called).
I'm rather new to web programming but I think I know the most important parts of what a session is. I would like to know for Sure though what the right definition is, so I can write about it in my thesis.
I've tried searching the web, but I haven't found the answers to some specific questions: 1. Is a new session always started when a user is redirected to a page that belongs to a different application (even if that application runs on the same server as the first one)? 2. In servlets: In the common model where only One server instance exists; is it running one thread per session, always?
It would be great if someone just knows any good links to where I can find answers to these questions.
1.) Yes sessions are per application. The user would have one session for each application, even if both applications are running on the same server.
2.) Not one thread per session. One thread per request.
Joined: Feb 12, 2008
Thank you, Ben!
I started looking in the servlet specification and I found this under the HttpSession Interface specification:
"Session information is scoped only to the current web application"
I think that was kind of an answer to question 1 and then I have your answer as well. Thanks!
About the second question.. When I think about it some more, it's obvious that a session needs more than one thread for "all its business" but one thread per request sounds logical. (I could have figured that out myself if I had just trusted myself and my brain some more so Sorry for taking up your time with this question.)