aspose file tools*
The moose likes Servlets and the fly likes what is the max age for JSESSIONID cookie. can we change it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "what is the max age for JSESSIONID cookie. can we change it?" Watch "what is the max age for JSESSIONID cookie. can we change it?" New topic
Author

what is the max age for JSESSIONID cookie. can we change it?

Lokendra Shekhawat
Ranch Hand

Joined: Jun 08, 2009
Posts: 40
Hi friends,
i wanted to ask one question:


What is the default max age for JSESSIONID cookie which is created when we use session. can we modify it.
if yes then how and where is correct place to modify it.


SCJP5 93%. SCWCD 98%.

Visit my website http://www.rajasthan4tourism.com for information about rajasthan tourist places and much more.....!!!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Use the <session-config> element in web.xml.

For example, see this thread. Searching the web for something like "java +configure session timeout" or similar will return a lot of hits.
Lokendra Shekhawat
Ranch Hand

Joined: Jun 08, 2009
Posts: 40
i want to prevent the cookie to be invalidated when user closes the browser. i want to set the JSESSIONID cookie to stay alive for say, 20 minutes, whether browser is running or closed. so when user closes the browser and reopen the browser and access the same site he can still use the same JSESSIONID to access the site.

is there any way?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's browser-specific behavior--so probably not.
Lokendra Shekhawat
Ranch Hand

Joined: Jun 08, 2009
Posts: 40
But most sites provide that feature like mail sites, orkut etc. how they use the session even browser restarts
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61226
    
  66

Many of those sites will use cookies to store the credentials so that a session can be automatically restarted.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is the max age for JSESSIONID cookie. can we change it?