permaculture playing cards
The moose likes Java in General and the fly likes delete cookie from request ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "delete cookie from request ?" Watch "delete cookie from request ?" New topic

delete cookie from request ?

Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 169
I have a standard func that deletes cookie:

But this is done only when response arives to client.
I need to read request before that and read from it, that cookie does not exist any more.
So I need also to delete cookie from request.

How to do that ?

Searchable nature photo gallery:
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

If I understand your question correctly, Cookies are created in server side and stored in client side. if cookie you have stored in client side expired, then it wont come with request. so no need to delete the cookie from request.
Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 169
so, I have a 'samplepage 'with

1.that jumps to server
2.there I delete cookie server side , but that i not deleted until whole thing comes back to client,
that is, whole page is loaded, then on the end cookie is deleted, that is how I see it.
3. hence logoff link is stil visible, when I come back to same page,allthough it should not be
4. proof:click browser refresh, and logoff is gone

Edit: upper thing might be wrong, but anyway,
If at the time beeing at server side I 'delete' cookie from response, I would like to read somewhere that it is deleted,
the best thing seems to be to check current request, which still has it.
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

Make a two phase logout.

From client you call "logout".
Server does what it should and return you to a "/logoutevent.jsp" that clears the cookies and redirect you to the next page.
I agree. Here's the link:
subject: delete cookie from request ?
It's not a secret anymore!