• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

session that never dies

 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setMaxInactiveInterval(-1) means the session never times out

setMaxInactiveInterval(0) means session times out immediately as soon as it
created

what does this mean ?

<session-config>
<session-timeout>0</session-timeout>
</session-config>
does thie mean same as setMaxInactiveInterval(0), excpt tha we have 0 seconds in the method ad 0 minutes in the D.D ;-)

<session-config>
<session-timeout>-1</session-timeout>
</session-config>

does this never time out ???

i am doing lots of fine tuning in my concepts..
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The followings are what I have in my brain:

session.setMaxInactiveInterval(-1); //the session never ends.
<session-timeout>0</session-timeout> //the session never ends
<session-timeout>-1</session-timeout> //the session never ends.


session.setMaxInactiveInterval(0);
//the session times out IMMEDIATELY. "session times out immediately" means ....well, the session ends as soon as it's created because the 'InActiveInterval' of this session is Zero second.
 
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a quote to show how confusing setMaxAge() and setMaxInactiveInterval():

setMaxAge(-1) -- cookie is not stored persistently and will be deleted when the Web browser exits
setMaxAge(0) -- cookie to be deleted
setMaxAge(1) -- cookie will expire after that many seconds have passed.

Can anyone fill it remaining thing correctly..

setMaxInactiveInterval(-1) --
setMaxInactiveInterval(0) --
setMaxInactiveInterval(1) -- session will be invalidated after that many seconds have passed.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
miacel, even i was comparing the timeouts between session and the cookies

thanks for all the info on page

will take a print out tomorrow !
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setMaxAge(-1) -- cookie is not stored persistently and will be deleted when the Web browser exits
setMaxAge(0) -- cookie to be deleted
setMaxAge(1) -- cookie will expire after that many seconds have passed.

Can anyone fill it remaining thing correctly..

setMaxInactiveInterval(-1) -- session never ends
setMaxInactiveInterval(0) -- session ends immediately
setMaxInactiveInterval(1) -- session will be invalidated after that many seconds have passed.

and as added by stella

<session-timeout>0<session-timeout> //never ends
<session-timeout>-1</session-timeout> //never ends

<session-timeout>1 </session-timeout> //time out after 1 minute

somebody please confirm the bold ones !! :roll:
 
Stella Kim
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Niranjan,
I think I've read somewhere that "..<session-time> value 0 or less means that the sessiion will never expire...." but, I don't remember where...
anyone can confirm ?
 
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Servlet spec. 2.4 -- page 128

The session-timeout element defines the default session timeout interval for all sessions created in this web application. The specified timeout must be expressed in a whole number of minutes. If the timeout is 0 or less, the container ensures the default behaviour of sessions is never to time out. If this element is not specified, the container must set its default timeout period.


From Servlet spec. 2.4 -- page 271

public void setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.

 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot..
that completes the concept
 
I'm not sure if I approve of this interruption. But this tiny ad checks out:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!