I was able to trace the source of the problem. When I add the cookie I call
setPath("/"); because I want the cookie visible across multiple webapps. However,
when I get the cookie out of the response by calling getCookies(), the value of
getPath() = null! So it's like the path information disappeared or isn't being
reconstructed correctly! So after I get the cookie from the request, I call
setPath("/") again and call setMaxAge(0), readd it to the response by calling
addCookie(c) and with that the cookie was sucessfully deleted! Not having the "/"
path persisting really through me. I didn't think of it because it seemed like such
an obvious thing that tomcat would handle.
<mike/>
-----Original Message-----
From: Milt Epstein [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 27, 2002 3:42 PM
To: Tomcat Users List
Subject: Re: how to delete a cookie?????
On Tue, 27 Aug 2002, Michael Remijan wrote:
> ...
>
> I'm testing the use of cookies by basically setting up a jsp page in
> two different contexts and flipping back and forth between them.
> I've tried to delete the cookie by calling setMaxAge() with -1, 0,
> and 1 but i've not been able to been able to successfully delete the
> cookie, i.e when i flip to the other context i get my "found cookie"
> message instead of the "cookie missing, adding a new one" message.
> Anyone been able to successfully delete a cookie?
You don't specify fully what you're doing to delete the cookie.
Remember, after you set up the cookie (BTW, max age of 0 should delete
it), you need to add the cookie to the response. Changing the cookie
in the request alone and/or not adding it to the response won't do
anything.
Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>