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

Programmatically removing a cookie

 
MalanS Subramanian
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
Is it possible to programatically remove a cookie? I tried looking in Servlet API and couldnt find any...

Thanks in advance
 
Chinmaya Chowdary
Ranch Hand
Posts: 432
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Malan. Can you please tell, in which situations this behaviour is needed? Thankyou.
 
MalanS Subramanian
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chinmaya,
I dont have any situations as such in my mind, but was just wondering whether this is doable.
 
Chinmaya Chowdary
Ranch Hand
Posts: 432
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Malan. Thanks for the reply. There is no remove method available in Servlet api. If we want to restrict particular client we can follow better alternatives, like filtering. As far my knowledge concerned, this behavior is not needed.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible to remove a cookie, you just need a little workaround.

Retrieve the cookie, set MaxAge to 0 and reinsert it.
 
MalanS Subramanian
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sebastian,
Thanks for the reply... thats a cute lil workaround
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apart from being cute, it's pretty much the only way to remove a cookie from the server side,,,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic