<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Remove on Pandurang Patil</title><link>https://www.pandurangpatil.com/tags/remove/</link><description>Recent content in Remove on Pandurang Patil</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 09 Feb 2014 02:02:00 -0800</lastBuildDate><atom:link href="https://www.pandurangpatil.com/tags/remove/index.xml" rel="self" type="application/rss+xml"/><item><title>Remove cookie.</title><link>https://www.pandurangpatil.com/post/2014-02-09-remove-cookie/</link><pubDate>Sun, 09 Feb 2014 02:02:00 -0800</pubDate><guid>https://www.pandurangpatil.com/post/2014-02-09-remove-cookie/</guid><description>To remove cookie from server one need to set its expiry time to current time.
e.g. J2EE container one can remove the cookie in following way
HttpServletResponse response = (HttpServletResponse) servletResponse; Cookie cookie = new Cookie(&amp;quot;cookie-key&amp;quot;, &amp;quot;&amp;quot;); //.... set all the other attributes same as that of existing cookie, like path and domain. cookie.setMaxAge(0); response.addCookie(cookie); setting max age of cookie to 0 I am setting its expiry to current machine time.</description></item></channel></rss>