• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

64 bit jsessionid in Struts

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic