my dog learned polymorphism*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "delete cookie from request ?" Watch "delete cookie from request ?" New topic
Author

delete cookie from request ?

Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 147
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: http://agrozoo.net/jsp/Galery.jsp?l2=en
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: 147
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: delete cookie from request ?
 
Similar Threads
setMaxAge(0) doesnt delete cookie?
Cookie - Web App mapping
Unable to retrieve cookie either through JSP or Javascript
design question: should the lock manager be synchronized whenever it's used in Data?
Difference between Cookies and Session in servlets