JDK-7076837 : Passing Set-Cookie2 header to CookieHandler.getDefault().put() has no effect in applet mode
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u24
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-08-09
  • Updated: 2011-09-22
  • Resolved: 2011-08-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7u2 b03Fixed 8Fixed
In the applet mode, passing Set-Cookie2 header to CookieHandler.getDefault().put() appears to have no effect. See the attached example.

The example applet constructs a map of HTTP headers as follows:

            Map<String, List<String>> headers =
                    new HashMap<String, List<String>>();
            headers.put("Set-Cookie2", Arrays.asList("x=0"));

and passes it to:

            handler.put(uri, headers);

The applet then immediately calls handler.get(uri, ...) and expects the result to include the cookie previosuly set with Set-Cookie2, but in my experiments that turns out to not be the case.

From the com.sun.deploy.net.cookie.DeployCookieSelector.put() method source code it follows that only "Set-Cookie" headers are supported. This seems odd because the javadoc for java.net.CookieHandler.put() explicitly mentions "Set-Cookie2".

This issue causes http://javafx-jira.kenai.com/browse/RT-15676

EVALUATION Add "Set-Cookie2" support in deployment code and update junit cookie test as well.

PUBLIC COMMENTS Well, I don't think this issue absolutely needs to be fixed for FX since a simple workaround seems to exist here. If I parse the code correctly, I can use "Set-Cookie" instead of "Set-Cookie2" to achieve the desired effect. I have already tried this workaround and confirmed that it solves my cookie problems. Unfortunately, it does not fully solve http://javafx-jira.kenai.com/browse/RT-15676, but that is probably unrelated to this issue. That said, I view this issue as a spec conformance problem only, not as a blocker for FX.