Pretty interesting....
Couldn't resist, so tried the following :-
Servlet code
JSP code (partial code)
<H2>Session is <%=request.getSession().getId()%></H2>
Browser - Mozilla Firefox v2.0.0.3
Web Container - Tomcat 5.0
Here is the Servlet Output Case 1:- Enable cookies a) First request sent:-
Output
Cookies are
New session 4C588E2FA3F77AC307459A557C6477D4 expires after 1800
b) Second request sent (new browser - Firefox new window)
Output
Cookies are
JSESSIONID 4C588E2FA3F77AC307459A557C6477D4
Old session 4C588E2FA3F77AC307459A557C6477D4 expires after 1800
Case 2:- Disable cookies (To be safe, block cookies from localhost )
a) First request sent:-
Output
Cookies are
New session 31747F37B0977622039AE913EF0A3D8B expires after 1800
b) Second Request sent:-
Output
Cookies are
New session A1F1556085377304BE8EB9D555EE0555 expires after 1800
When the servlet redirects to Result.jsp, i see the sessionid appended to the URL, but now when we open a new window and say
"http://localhost/beer/Result.jsp" a new session is created. (since jsessionid is NOT appended), but would the user ever append the session id? Dont think so.
So how does URL rewriting work?
[ May 19, 2007: Message edited by: swarna dasa ]