| Author |
session that never dies
|
Niranjan Deshpande
Ranch Hand
Joined: Oct 16, 2005
Posts: 1277
|
|
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..
|
SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
|
 |
Stella Kim
Greenhorn
Joined: Jan 18, 2007
Posts: 25
|
|
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.
|
Kim<br />SCJP 1.4 (98%)<br />SCWCD (92%)
|
 |
Micheal John
Ranch Hand
Joined: Nov 01, 2006
Posts: 344
|
|
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.
|
Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
|
 |
Niranjan Deshpande
Ranch Hand
Joined: Oct 16, 2005
Posts: 1277
|
|
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
Joined: Oct 16, 2005
Posts: 1277
|
|
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
Joined: Jan 18, 2007
Posts: 25
|
|
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 ?
|
 |
Sayak Banerjee
Ranch Hand
Joined: Nov 28, 2006
Posts: 292
|
|
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.
|
Turn on, tune in, drop out.
|
 |
Niranjan Deshpande
Ranch Hand
Joined: Oct 16, 2005
Posts: 1277
|
|
thanks a lot.. that completes the concept
|
 |
 |
|
|
subject: session that never dies
|
|
|