Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

addCookie method

 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a cookie have multiple values ? What will happen if the addCookie method is invoked twice with the same cookie name and different values ?

Thanks
Devi
 
amit taneja
Ranch Hand
Posts: 813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think it will override the value with the given name...
try it out and dirt your hands..
 
Ayesha Tasneem
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

A Cookie can have only one name value pair,

if same Cookie name is used with different Cookie values,then it takes Cookie name and the last Cookie value set in sequence.
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there's a little more to it than that.

I think that it first looks at the domain, then the path, then, if those match, then the cookie is compared by name.


Here's some rfc's I googled:
http://www.faqs.org/rfcs/rfc2965.html
http://www.faqs.org/rfcs/rfc2109.html
 
kapil munjal
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Garrett,

You are right it does matches domain and then path...but the scenario which has been asked by Vinod, in that it is generated by the same servlet. So, if something like this happens then it will override the value and put the new value with the old key.

Correct me if I am wrong.

Kapil
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic