Does JEP automatically configure a URLConnection with cookies from the browser? I'm developing an applet that needs to connect back to a site that uses cookies for authentication and it seems the URLConnection I use does NOT pick up cookies from the browser. The same code seems to work fine in Safari as well as within the Sun Java Plugin on Windows & Linux.
Thanks,
Wyatt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
One or two others have asked about cookie support ... and it's really
from what they've told me that I've concluded that cookie support
doesn't work (or works only partially) with the JEP. But I don't
understand why, and I haven't yet had the chance to look into the
matter.
Please point me at some documentation and sample code that shows how
the cookie support is _supposed_ to work. It'd also really help if
you could post the source code for a test-case applet that
demonstrates your problem -- one that uses cookies and that works in
Safari and with other versions of the Sun Java Plugin, but not with
the JEP.
I can't promise that I'll be able to fix the problem. But with better
information I'll at least know where to start.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
From what I gather it's just supposed to work, there's nothing special you have to do with the URLConnection, just create it and open it. Apple has a technote which is available at:
that describes how cookie support was broken in older versions of Safari (it's since been fixed). What's really curious is that I can't get the workaround they outline to work in JEP.
Hope this helps,
Wyatt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is still broken with Firefox 1.5 and Camino 1.0, using either Java 1.4.2 or Java 1.5 on Mac OS X 10.4.5. It basically means that my users can't use Firefox or Camino -- they have to use Apple's Safari instead.
<p>The posted Apple workaround isn't useful for us -- too much hackery.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Java Plug-in 1.5.0
Using JRE version 1.5.0_05 Java HotSpot(TM) Client VM
...[lots of lines elided]...
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@682406, refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@d8ca48
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
basic: Loading https://reflux.parc.xerox.com:8090/html/UpLibPageview.jar from cache
basic: No certificate info, this is unsigned JAR file.
...[more stuff removed]...
network: Connecting https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711 with cookie "CP=null*; uplibnonce8091=bc109174bc33c7ff598bd153f5c8c2b68f6d0bfc; FRQSTR=18880077|18880077|18880077|18880077|18880077"
Reading scribbles from sun.net.www.protocol.https.DelegateHttpsURLConnection:https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711, sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@694eca
On the other hand, from Camino 1.0 I get:
Java Plug-in 1.5.0
Using JRE version 1.5.0_05 Java HotSpot(TM) Client VM
...[lots of lines elided again]...
MRJ Plugin for Mac OS X v1.0.1
[starting up Java Applet Security @ Wed Mar 15 16:38:35 PST 2006]
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@7c2891, refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@6f8b2b
basic: Loading applet ...
basic: Initializing applet ...
basic: Loading https://reflux.parc.xerox.com:8090/html/UpLibPageview.jar from cache
basic: No certificate info, this is unsigned JAR file.
Wed Mar 15 16:38:37 PST 2006 JEP creating applet com.parc.uplib.docviewer.UpLibPageview (https://reflux.parc.xerox.com:8090/)
Title: com.parc.uplib.UpLibPageview $Revision: 1.34 $, $Date: 2006/03/11 22:53:43 $
...[more stuff removed]...
network: Connecting https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711 with cookie "CP=null*; FRQSTR=18880077|18880077|18880077|18880077|18880077"
Exception reading scribbles: java.io.IOException: Server returned HTTP response code: 401 for URL: https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711
java.io.IOException: Server returned HTTP response code: 401 for URL: https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711
So the secure session cookie "uplibnonce" is being passed by Safari, but not by Camino and JEP.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does JEP automatically configure a URLConnection with cookies from the browser? I'm developing an applet that needs to connect back to a site that uses cookies for authentication and it seems the URLConnection I use does NOT pick up cookies from the browser. The same code seems to work fine in Safari as well as within the Sun Java Plugin on Windows & Linux.
Thanks,
Wyatt
The short answer to your question is "no".
One or two others have asked about cookie support ... and it's really
from what they've told me that I've concluded that cookie support
doesn't work (or works only partially) with the JEP. But I don't
understand why, and I haven't yet had the chance to look into the
matter.
Please point me at some documentation and sample code that shows how
the cookie support is _supposed_ to work. It'd also really help if
you could post the source code for a test-case applet that
demonstrates your problem -- one that uses cookies and that works in
Safari and with other versions of the Sun Java Plugin, but not with
the JEP.
I can't promise that I'll be able to fix the problem. But with better
information I'll at least know where to start.
From what I gather it's just supposed to work, there's nothing special you have to do with the URLConnection, just create it and open it. Apple has a technote which is available at:
http://developer.apple.com/qa/qa2001/qa1265.html
that describes how cookie support was broken in older versions of Safari (it's since been fixed). What's really curious is that I can't get the workaround they outline to work in JEP.
Hope this helps,
Wyatt
This is still broken with Firefox 1.5 and Camino 1.0, using either Java 1.4.2 or Java 1.5 on Mac OS X 10.4.5. It basically means that my users can't use Firefox or Camino -- they have to use Apple's Safari instead.
<p>The posted Apple workaround isn't useful for us -- too much hackery.
to add another data point:
i am seeing persistent cookies added to requests, but *NOT* session cookies.
Here's what I see in the Safari Java console:
Java Plug-in 1.5.0
Using JRE version 1.5.0_05 Java HotSpot(TM) Client VM
...[lots of lines elided]...
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@682406, refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@d8ca48
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
basic: Loading https://reflux.parc.xerox.com:8090/html/UpLibPageview.jar from cache
basic: No certificate info, this is unsigned JAR file.
...[more stuff removed]...
network: Connecting https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711 with cookie "CP=null*; uplibnonce8091=bc109174bc33c7ff598bd153f5c8c2b68f6d0bfc; FRQSTR=18880077|18880077|18880077|18880077|18880077"
Reading scribbles from sun.net.www.protocol.https.DelegateHttpsURLConnection:https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711, sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@694eca
On the other hand, from Camino 1.0 I get:
Java Plug-in 1.5.0
Using JRE version 1.5.0_05 Java HotSpot(TM) Client VM
...[lots of lines elided again]...
MRJ Plugin for Mac OS X v1.0.1
[starting up Java Applet Security @ Wed Mar 15 16:38:35 PST 2006]
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@7c2891, refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@6f8b2b
basic: Loading applet ...
basic: Initializing applet ...
basic: Loading https://reflux.parc.xerox.com:8090/html/UpLibPageview.jar from cache
basic: No certificate info, this is unsigned JAR file.
Wed Mar 15 16:38:37 PST 2006 JEP creating applet com.parc.uplib.docviewer.UpLibPageview (https://reflux.parc.xerox.com:8090/)
Title: com.parc.uplib.UpLibPageview $Revision: 1.34 $, $Date: 2006/03/11 22:53:43 $
...[more stuff removed]...
network: Connecting https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711 with cookie "CP=null*; FRQSTR=18880077|18880077|18880077|18880077|18880077"
Exception reading scribbles: java.io.IOException: Server returned HTTP response code: 401 for URL: https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711
java.io.IOException: Server returned HTTP response code: 401 for URL: https://reflux.parc.xerox.com:8090/action/basic/dv_get_scribbles?doc_id=01126-05-6963-711
So the secure session cookie "uplibnonce" is being passed by Safari, but not by Camino and JEP.
Java 5 introduced the new java.net.CookieHandler class. The browser plug-in framework must implement that somehow.
http://java.sun.com/j2se/1.5.0/docs/api/java/net/CookieHandler.html
Here's a list of classes that support cookies in Java 5 on Mac OS X 10.4.5:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5 % find . -name \*.jar -exec jar tf {} \; | grep Cookie
java/net/CookieHandler.class
org/omg/PortableServer/ServantLocatorPackage/CookieHolder.class
com/sun/net/ssl/internal/ssl/RandomCookie.class
com/sun/deploy/net/cookie/CookieHandler.class
com/sun/deploy/net/cookie/CookieUnavailableException.class
com/sun/deploy/net/cookie/CookieStore.class
com/sun/deploy/net/cookie/HttpCookie.class
com/sun/deploy/net/cookie/DeployCookieManager.class
com/sun/deploy/net/cookie/DeployCookieSelector.class
com/sun/deploy/net/cookie/GenericCookieHandler.class
com/sun/deploy/net/cookie/NetscapeCookieStore$1.class
com/sun/deploy/net/cookie/NetscapeCookieStore$2.class
com/sun/deploy/net/cookie/NetscapeCookieStore.class
com/sun/deploy/net/cookie/SessionCookieStore.class
com/sun/deploy/net/cookie/MacOSXCookieHandler.class
/System/Library/Frameworks/JavaVM.framework/Versions/1.5 %
Works now, see http://sourceforge.net/forum/forum.php?thread_id=1634825&forum_id=371124