Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cookie

 
Lee Kian Giap
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
may I know the difference between

cookie.setMaxAge(0);
cookie.setMaxAge(-1);

?


Thank you.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is fully described in the javax.servlet.http.Cookie API.
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A positive value indicates that the cookie will expire after that many seconds have passed.----Fine
A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits.----Fine
A zero value causes the cookie to be deleted.--when coockie is deleted when value is zero, is it after that request???
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A zero value causes the cookie to be deleted.--when coockie is deleted when value is zero, is it after that request?

Cookies are set in the response; once the response reaches the browser, the cookie is deleted.
 
Abdul Rahman
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means if we are using cookies for session management, this will never get realised since each time the response reaches the browser, the cookie is deleted and hence the information from cookie can never be retrieved. Right ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic