File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HttpSession Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HttpSession" Watch "HttpSession" New topic
Author

HttpSession

Justin Rundle
Ranch Hand

Joined: Mar 26, 2008
Posts: 123

Just need some clarification and can't find anything rock solid in HFSJ. More so my question is related to setting the timeout interval for a session, what is the following result:

session.setMaxInactiveInterval(0) = ...
session.setMaxInactiveInterval(-1) = ...
<session-timeout>0</session-timeout> = ...
<session-timeout>-1</session-timeout> = ...

I under it that either 0 or -1 for either setMaxInactiveInterval and <session-timeout> will cause the session to never invalidate. Is that correct for both?
Santosh Raveendran
Ranch Hand

Joined: Jun 29, 2008
Posts: 83
session.setMaxInactiveInterval(0) =session is never valid
session.setMaxInactiveInterval(-1) = session is never expired
<session-timeout>0</session-timeout> =session is never expired
<session-timeout>-1</session-timeout> = session is never expired
[ December 18, 2008: Message edited by: santosh raveendran ]

SCJP 1.4,SCWCD5, SCBCD5
Thanks, Santhosh
Justin Rundle
Ranch Hand

Joined: Mar 26, 2008
Posts: 123

so if session.setMaxInactiveInterval(0) expires the session then is this equivalent to invoking session.invalidate()?
Santosh Raveendran
Ranch Hand

Joined: Jun 29, 2008
Posts: 83
yes Justin you are correct
Justin Rundle
Ranch Hand

Joined: Mar 26, 2008
Posts: 123

Awesome thanks for your help, yet another inconsistency to remember
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpSession