File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt between setMaxAge() and setMaxInactiveInterval() method

 
prashant k. gupta
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A negative number for setMaxIncativeInterval causes the Session to never expire.
A negative number for setMaxAge causes the cookie to persist until browser shutdown.
 
Ankit Mishra
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got your point Sebastian thanks went through the api too ..
 
prashant k. gupta
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Mishra wrote:got your point Sebastian thanks went through the api too ..



Thanks Sebastian and Ankit for your quick response.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic