• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

64 bit jsessionid in Struts

 
Yogendra Joshi
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends ,

The day yesterday i was using the application made by me in Struts. Whenevr i login , Normally it alwayz showed 32 bit session id which is being generated by the Server...

However , Today when i logged in it had shown me 64bit jsessionid. I wanted to know what exactly is this and also wanted to know that i have not used url rewriting then too how automatically does it append jsessionid to the end of URL ?

Thanks in Advance.
Yogendra Joshi
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSessionId isn't generated by Struts. It's generated by your application server. Generally, an application server will use cookies to determine which HttpSession a user belongs to.

Cookies are not 100% reliable, though, because they can be turned off on the browser. To cover this possibility, the application server can append the session id with every link and use it to determine the session.

This is called URL Rewriting, and it's done by passing the URL to the encodeURL method on the HttpServletResponse object. This causes the application server to append the JsessionId to the URL. If you're using Struts tags exclusively, you don't have to worry about URL rewriting because struts calls the encodeURL method for every link and action. However, if cookies are enabled on your browser, it's the cookie and not the JsessionId that's being used to attach you to a session.
 
Yogendra Joshi
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Merrill Thanks for the reply.

I understand that the URL rewriting process is done using the servlet container and not by Struts, It was only that i have worked on Struts for the first time and noticed 64bit i.e 64 characters after jsessionid as in here ... http://localhost:8000/Yogendra/abc.jsp?jsessionid=sadasdasdaasdewfvfgdff....

So my question was why did it generate 64 chars in place of 32 chars by default which i alwayz have seen..

Waiting for your kind suggestions again.

Thanks
Yogendra Joshi.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the Application Server is responsible for the generation of the JSessionId, the answer as to why it is using 64 characters lies in the documentation of whatever application server you're using. The fact that you're using Struts has nothing to do with it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic