File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Java 1.6: Setting persistant cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Java 1.6: Setting persistant cookies" Watch "Java 1.6: Setting persistant cookies" New topic

Java 1.6: Setting persistant cookies

David Kafrissen

Joined: May 04, 2004
Posts: 10

We are trying to set persistant cookies. Can this be done? If we close the browser and come back the cookies are not there.

We are using the java plugin default cookie handler.

The web server is embedded so we can not script from there.

What we want is a remember me button on the applet which just supresses the login box on subsequent runs.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
I don't think any cookies set with the Java plugin can be made persistent, but you can use the getStream/setStream methods of AppletContext to store little pieces of information locally. That should work just as well here.
David Kafrissen

Joined: May 04, 2004
Posts: 10
thanks, this seems perfect, I actually do not care how the data is stored. And I am only storing a small bit of data.

Are there any docs that describe were this data goes?

Just curious, the javadoc on the api does not list where the data actually goes.
David Kafrissen

Joined: May 04, 2004
Posts: 10
This does not seem to work.

While the browser is running, we can save and retrieve info.

However, once the browser closes, the data goes away.

Our goal is to have a "remember me" box when the user logs into the applet.

Our applet controls an embedded device.

There is only one main login, the goal is since this device is on the local network, only people who know the password, who have read the manual, can get in to the applet to control the device.

Once someone has logged in once to the applet, we are assuming that the same person would be logging in on "that" computer so that once they have logged in, they should be able to hit remember me.

We want the remember me only for that computer, not every computer on the local area network.
I agree. Here's the link:
subject: Java 1.6: Setting persistant cookies
It's not a secret anymore!