On 6/15/06, Mon Cab <[EMAIL PROTECTED]> wrote:
Hi All of a sudden tomcat has stopped settign session cookies. I have been developing on my local machine for approx 1yr. Now, When I goto my webapps home page: http:/127.0.0.1:8080/webapp), tomcat is rewriting the URL as http://127.0.0.1:8080/webapp/Welcome.do;jsessionid=DAF0604E76E234C157A9BFDF53FD2617 , indicating that it is not setting a session cookie. When I check the session cookie folder C:\Documents and Settings\user\Cookies. There is no jsessionid cookie. When I set a cookie from within webapp, the cookie is set as normal and stored in the cookie folder C:\Documents and Settings\user\Cookies, and is retrieved by my web application. Why is Tomcat not setting a session cookie? I configured my browser to accept all session cookies. I am using Windows XP Pro, with IE6, j2sdk1.4.2_08, Tomcat 5.0.28. This has been working as it is supposed to for 1 year. Can anyone explain what is going on?
When you submit the very first request in a new session, Tomcat has no way to know whether your client has cookies enabled or not. So, it sends the session id both ways (via URL rewriting, and by sending a cookie). If the second request comes back in with a cookie, Tomcat says "aha, this particular client supports session cookies" and turns off the rewriting. Otherwise, it will continue the rewriting for all subsequent requests in the same session. Craig