Doubt between setMaxAge() and setMaxInactiveInterval() method
prashant k. gupta
Ranch Hand
Joined: May 15, 2008
Posts: 60
posted
0
I have doubt on these two methods :- setMaxAge() for cookie and setMaxInactiveInterval() for session... what will happen if we set -1 for these method?
can someone please clarify.
Sebastian Janisch
Ranch Hand
Joined: Feb 23, 2009
Posts: 1183
posted
0
A negative number for setMaxIncativeInterval causes the Session to never expire.
A negative number for setMaxAge causes the cookie to persist until browser shutdown.
JDBCSupport - An easy to use, light-weight JDBC framework -
Ankit Mishra
Ranch Hand
Joined: Jul 15, 2009
Posts: 40
posted
0
when you will put -1 as a value that means for cookies you don't want that cookie to be removed even when session expires or when client leaves the browser. In case of session you don't want to invalidate it on the basis of time.
Ankit Mishra wrote:when you will put -1 as a value that means for cookies you don't want that cookie to be removed even when session expires or when client leaves the browser. In case of session you don't want to invalidate it on the basis of time.
Correct me if i am wrong
Not correct.
This is what the API states for setMaxAge()...
A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted.
Ankit Mishra
Ranch Hand
Joined: Jul 15, 2009
Posts: 40
posted
0
got your point Sebastian thanks went through the api too ..
prashant k. gupta
Ranch Hand
Joined: May 15, 2008
Posts: 60
posted
0
Ankit Mishra wrote:got your point Sebastian thanks went through the api too ..
Thanks Sebastian and Ankit for your quick response.