wood burning stoves*
The moose likes Servlets and the fly likes response does not save session id in cookie if it is from url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "response does not save session id in cookie if it is from url" Watch "response does not save session id in cookie if it is from url" New topic
Author

response does not save session id in cookie if it is from url

zheng li
Ranch Hand

Joined: Jun 16, 2009
Posts: 56
i am using tomcat.
if i use jsessionid=617AA28660D5C1B1408543C24B186A75 in url to send session id to server, response does not put it in cookie, so if redirect happens, a completely new session will be created.

is it a bug or http specification?
i can't find anything about it in rfc though.

or is there any configuration about it in tomcat?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3827

Are you saying that you manage the "jsessionid" within your code? Then don't, it's up to the container.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
zheng li
Ranch Hand

Joined: Jun 16, 2009
Posts: 56
i am not manage jsessionid myself.
just that i found this problem and don't understand why.

it seems that the two way of managing session id can not coexist.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3068
    
  33

zheng li wrote:i am not manage jsessionid myself.
just that i found this problem and don't understand why.

it seems that the two way of managing session id can not coexist.


Is it not that either URL Rewriting or Cookies are used for session management?


Mohamed Sanaulla | My Blog
zheng li
Ranch Hand

Joined: Jun 16, 2009
Posts: 56
mohammed sanaullah wrote:
zheng li wrote:i am not manage jsessionid myself.
just that i found this problem and don't understand why.

it seems that the two way of managing session id can not coexist.


Is it not that either URL Rewriting or Cookies are used for session management?


yes, you are right.
thank you.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You don't send the session id to the server. Let Tomcat create them for you.
If there is a session id in the URL and Tomcat can't match it up to an existing session in memory, it just assumes that it is expired and ignores it.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: response does not save session id in cookie if it is from url