• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Invalidation

 
marlon tan
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What if i have
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
in my deployment descriptor, and along with this, I perform setMaxInactiveInterval(2400) for my session object.
The first one denotes 30 minutes and the second one is 40 minutes. Which one will be followed; that is, how long will my session expire? Will it be 30 or 40 minutes?
What if for example I interchanged the figures -- i have 40 minutes in deloyment descriptor and 30 minutes for setMaxInactiveInterval()?
Thank you very much.
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The discussion of Session timeout from Servlet Specs
"The default timeout period for sessions is defined by the servlet container and can be obtained via the getMaxInactiveInterval method of the HttpSession interface. This timeout can be changed by the Developer using the setMaxInactiveInterval method of the HttpSession interface."
The timeout defined in your DD is used until you redefine it with setMaxInactiveInterval. So, if you use setMaxInactiveInterval that will be the timeout for that servlet regardles of the value in the DD.
------------------
I Hope This Helps
Carl Trusiak, SCJP2
 
marlon tan
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much, Sir!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic