Thanks for the quick reply. I finally fixed the problem. What I found was
that when I was creating my cookie I was calling setPath("/") and when I
deleted it I was not calling setPath("/"). So I guess the equals method saw
them as two different cookies and it wasn't deleting it. There is actually a
convenience method on the WebResponse class called clearCookie that I am
calling. However, that method will not work if you have called setPath("/")
on your cookie because it doesn't set the path. It just does the following:

        public void clearCookie(final Cookie cookie)
        {
                if (httpServletResponse != null)
                {
                        cookie.setMaxAge(0);
                        cookie.setValue(null);
                        addCookie(cookie);
                }
        }

Thanks,

Josh


richardwilko wrote:
> 
> Ive had the same problem.  to delete a cookie do this:
> 
> Cookie newCookie = new Cookie("my cookie name here!", null);
> newCookie.setMaxAge(0);
> newCookie.setPath("/");
> getWebRequestCycle().getWebResponse().addCookie(newCookie);   
> 
> i dont know why (i didnt really look into it) but u seem to have to create
> a new cookie with the same name and add it.  maybe this is a wicket bug?
> 
> Richard
> 

-- 
View this message in context: 
http://www.nabble.com/forcing-cookies-to-expire-tp17067292p17760587.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to