GeeCON Prague 2014*
The moose likes Java in General and the fly likes how to delete cookie and temporary internet files using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "how to delete cookie and temporary internet files using java" Watch "how to delete cookie and temporary internet files using java" New topic
Author

how to delete cookie and temporary internet files using java

Shrikant Kulkarni
Ranch Hand

Joined: May 10, 2005
Posts: 42
Hi,
I wrote a JSP page after sucessfully logging into the application. In that JSP page i have a logoff option. When user clicks on logoff button all the cookis and temporary internet files for that particluar browser, i want to delete it.
So can any one please help in writing that peace of java code??

Thanks well in advance.

Shrikant
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The JSP is run on the server and outputs a HTTP response, probably made up of HTML but possibly binary content instead. Whatever this content is, only it gets sent to the client and only it could possibly effect the broowser cache (or the HTTP header, but we'll get to that).

So on the client, you want something which runs on the client side to clear the cache for the current site. I'm pretty sure it can't be done and the security measures would block you. However if all communication was in HTTPS and the user had the option selected to prevent caching secure content set then the cache wouldn't exist, but again you can't enforce this setting. If you had already specified that each piece of content should not be cached as you sent it to the client it would not be cached, but this requires setting HTTP headers to instruct the browser not to cache the content.

With respect to cookies, if it is a session cookie it should be memory only and not resident. You can get all of the cookies from the request and set them to expire immediately and they'll disappear. It's all in the API and can be done on the server.

Dave
 
GeeCON Prague 2014
 
subject: how to delete cookie and temporary internet files using java