Hi,
I have an
applet and I am
testing some slightly modified code from the documentation (at
http://java.sun.com/docs/books/tutorial/deployment/doingMoreWithRIA/accessingCookies.html). The plan is to set a cookie and retrieve all cookies for the URL. Then it prints them out.
Unfortunately, as far as I can tell the cookie is not being added. When I print 'cookieJar.getCookie()' immediately after the add method its there, but when I run the code a second time, it does not print out any cookies in the first half of the code. It appears to print out cookies for
http://www.sun.com, which is why I think it is not adding.
Basically I want it to add a cookie which I can retrieve later, but I cannot seem to add the cookie. Does anyone know how I can do this?
I have my policy file set as 'permission java.security.AllPermission;'. I am running this in appletviewer at the moment. This method uses the java.net package for cookies as opposed to the netscape package to control javascript. I figured it would be easier to use an existing package than download another one. The code is below.
Thanks for any help.