views:

14

answers:

1

I know that there is a 99% chance of the answer to this question being "no" due to the nature of Applets, but I'm going to ask anyways.

I have a SmartCard containing X.509 certificates and applets. I'd like to be able to interact between the webapp and one of the applets in a read-only manner to pull data via that applet that is unavailable in the certificate.

Again, I know that applets are supposed to be sandboxed, which should prevent such a thing, but I thought I would ask anyways.

Jason

+1  A: 

You can use java.net.URLConnection to fire HTTP requests. An applet is allowed to fire HTTP requests on own domain as obtained by Applet#getCodeBase().

URL url = new URL(getCodeBase(), "scriptURL");
URLConnection connection = url.openConnection();
// ...

Substitute "scriptURL" by the path of whatever server side script is listening on the domain, e.g. "script.php", "servletURL", etcetera. You can pass data as request parameters the usual HTTP way.

See also:

BalusC