aspose file tools*
The moose likes Servlets and the fly likes Is cookies are mandatory for session management? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Is cookies are mandatory for session management?" Watch "Is cookies are mandatory for session management?" New topic
Author

Is cookies are mandatory for session management?

Nagaraj Shivaklara
Ranch Hand

Joined: Dec 16, 2008
Posts: 78
Hi,

Can you please explain me why cookies needs to be enabled for the session? without cookies cant we have session?

Thanks
Nagaraj


Thanks n Regards,
Nagaraj S K
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
No, cookies are not needed for session handling. There is another mechanism called "URL rewriting" which can be used instead. Note that this requires all URLs sent to the client to be treated especially.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

Tim is right. The server should check if cookies are enabled, and if not it should add the session ID to the URLs. You can do this with HttpServletResponse's encodeRedirectURL and encodeURL methods.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 606

Rob Spoor wrote:You can do this with HttpServletResponse's encodeRedirectURL and encodeURL methods.


or use a framework that does the hard work for you. Most (or is it all ?) web frameworks do this for you behind the scene.


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is cookies are mandatory for session management?