I tend to shun away from applets at all costs, so I can't claim to know
a great deal about them, but I find it highly unlikely for sun's
UrlConnection to be able to consult browser's cookie cache.

Actually, on Windows, with the Sun JRE and using IE, Sun's URLConnection does in fact send any cookies that apply to the page the applet is embedded in. Relying on this behavior however is a massive platform dependency as there is no requirement for this to occur. In particular, if you were to try this on Mac, Linux or Solaris you'd find the cookie is not sent. The workaround however is quite simple. In fact, there is no guarantee that this will occur with future versions of the Java Plugin or IE either. In short, don't depend on this occurring.


When writing out the applet tag (or object or embed tag) you'll have something like:

<applet code="blah" archive="myjar.jar">
        <param name="name" value="value">
</applet>

Simply insert an extra parameter using JavaScript, ie:

<script language="JavaScript">
document.write('<param name="cookie" value="' + document.cookie + '">');
</script>


Careful with the ' and " characters in there. Then in your applet, just pass the cookie param through to HttpClient.

Then make sure you're following all of Oleg's other suggestions which are likely causes of problems as well. :)

Regards,

Adrian Sutton.
----------------------------------------------
Intencha "tomorrow's technology today"
Ph: 38478913 0422236329
Suite 8/29 Oatland Crescent
Holland Park West 4121
Australia QLD
www.intencha.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to