Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

setMaxInactiveInterval and <session-timeout> question

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are the following four the same ?




 
Chrix Wu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found a potential incorrect note in FREDERIC ESNAULT's revision notes

he said in setMaxInactiveInterval() , -1 works like invalidate()

but the offical API said A negative time indicates the session should never timeout.

why??
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
setMaxInactiveInterval() takes time in second and web.xml we specify the time in minute.

then think on it. Read Head first for Servlet & JSP Session management chapter for more clarification .
 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Session
setMaxInactiveInterval(0) == invalidate()
setMaxInactiveInterval(-1) == session will never expire

Cookie
setMaxAge(0) == cookie is invalidated
setMaxAge(-1) == cookie is valid till browser closing
 
Chrix Wu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lucas Smith wrote:Session
setMaxInactiveInterval(0) == invalidate()
setMaxInactiveInterval(-1) == session will never expire

Cookie
setMaxAge(0) == cookie is invalidated
setMaxAge(-1) == cookie is valid till browser closing



what if i set the "time-out" in DD to the value of -1?
 
Sheriff
Posts: 9691
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the servlet spec about <session-timeout>

If the timeout is 0 or less, the container ensures the default behavior of sessions is never to time out.

 
Chrix Wu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankit Garg wrote:From the servlet spec about <session-timeout>

If the timeout is 0 or less, the container ensures the default behavior of sessions is never to time out.


Thanks
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's misleading.
setMaxInactiveInterval(0) -> invalidate()
<session-timeout>0</session-timeout> -> never invalidate
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lucas Smith wrote:Session
setMaxInactiveInterval(0) == invalidate()
setMaxInactiveInterval(-1) == session will never expire

Cookie
setMaxAge(0) == cookie is invalidated
setMaxAge(-1) == cookie is valid till browser closing



thank you.
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

warunyou rattanabuangam wrote:

Lucas Smith wrote:Session
setMaxInactiveInterval(0) == invalidate()
setMaxInactiveInterval(-1) == session will never expire

Cookie
setMaxAge(0) == cookie is invalidated
setMaxAge(-1) == cookie is valid till browser closing



thank you.



if i make request.getSession(false).setMaxInactiveInterval(0); the session will never expire..

 
Creator of Enthuware JWS+ V6
Posts: 3398
312
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
have a look at this thread for more about his subject.

Regards,
Frits
 
reply
    Bookmark Topic Watch Topic
  • New Topic