WelcomeTo
WelcomeTo

Reputation: 20571

Applets permissions when called from JS

We need to get list of client local printers in JavaScript code. We know that JS can't access local resources. So we decided to use Java applet. We make applet and sign it, but when applet accessed from JavaScript code (untrusted code), it implies that the signed applet essentially behaves likes an unsigned applet. And unsigned applet can't access to local printer list.

What can I do to solve this problem (without using java.policy file, because we can't install this file to each client)?

Thanks!

Upvotes: 3

Views: 324

Answers (1)

Pablo
Pablo

Reputation: 3673

You need to wrap the problematic code (the code that throws the exception because of lack of permissions) in a PrivilegedAction or a PrivilegedExceptionAction, and then call it using the doPrivileged methods of AccessController.

Upvotes: 2

Related Questions