Hello!
My code:
InputStream in = null;
URL url = new URL("http://my.url:80/myfile");
URLConnection connection = url.openConnection();
in = connection.getInputStream();
ObjectInputStream ois = new ObjectInputStream(in);
vFile = (Vector) ois.readObject(); // error
When i run this code in appletviewer i get no errors, but in browser in
get this message: access denied (Java.lang.RuntimePermission
accessClassInPackage.sun.swing)
In there any way to solve this problem without dig. signing the applet?
Or perhaps to use some alternative to ois.readObject()...
Niels Dybdahl - 05 May 2006 13:00 GMT
> Hello!
>
[quoted text clipped - 12 lines]
>
> In there any way to solve this problem without dig. signing the applet?
It is possible without signing if your applet is started from the same
server. If the applet is started from somewhere else, it will not work.
If you use getCodeBase() instead of a hardcoded path, then you ensure that
the server is exactly the same.
Niels Dybdahl
MiranL@gmail.com - 05 May 2006 15:28 GMT
The problem is not in the connection between server and client but in
this line:
(Vector) ois.readObject();
Oliver Wong - 05 May 2006 18:37 GMT
> The problem is not in the connection between server and client but in
> this line:
> (Vector) ois.readObject();
Regardless of where the exception is thrown, one of the restrictions for
unsigned applets is that you cannot connect to any server except the one
from which the applet is downloaded from. So when you're running this applet
within your browser, is the applet being downloaded from http://my.url:80/ ?
- Oliver
Andrew T. - 06 May 2006 03:53 GMT
...
> URL url = new URL("http://my.url:80/myfile");
> URLConnection connection = url.openConnection();
...
> When i run this code in appletviewer i get no errors, but in browser in
> get this message: access denied (Java.lang.RuntimePermission
> accessClassInPackage.sun.swing)
As you should.
> In there any way to solve this problem without dig. signing the applet?
If you find one please let us know, so we can get Sun
to issue a patch for it.
Andrew T.