Unsigned applet socket JavaScript

北慕城南 提交于 2020-01-02 20:59:46

问题


With Java 1.6.0.22 i'm not able to open a socket to localhost, the applet is unsigned and is being loaded from the webserver http://localhost/myapplet

If i load it from my computer ip 192.168.1.x and open a socket to that ip it works

With a simple demo that only open a socket it works, but as soon as my applet use JavaScript to Java calls the socket not work.

If I add a crossdomain.xml file the socket works again.

If I allow only 127.0.0.1 it doesn't work

With 1.6.0.17 it works fine

That is similar to question Socket connection to originating server of an unsigned Java applet

But in my case i loading applet from a webserver not from local file system.


回答1:


Via this user having a similar problem i found the relevant oracle bug

access denied (java.net.SocketPermission 127.0.0.1:8080 connect,resolve)

http://www.oracle.com/technetwork/java/javase/6u22releasenotes-176121.html




回答2:


Unsigned applets can only open connections to the host they were loaded from.




回答3:


Oracle knows of this Java problem that severely restricts use of Applets: A Security Vulnerability in the Java Runtime Environment may Allow Code Loaded From the Local Filesystem to Access LocalHost. The translation: if you wish to run Java Applets that talk to a server like Tomcat, you can’t do it with recent Java releases

And their solution is: There is no workaround for this issue.

And how long have they known of this problem? 03-Dec-2008, Bug Id 6704154

You can validate the above information at, https://identity.sun.com/amserver/UI/Login?org=self_registered_users&goto=http://sunsolve.sun.com/show.do?target=home




回答4:


While the documentation says an applet can only open a connection to the host it was loaded from, with Tomcat 5, that statement is not true. I have an applet that invariably generates a, "AccessControlException:access denied (java.net.SocketPermission 66.167.210:80 connect, resolve" even though I've given socket permission to this URL. I'm still trying to solve this issue and am open to any recommendations.



来源:https://stackoverflow.com/questions/4203583/unsigned-applet-socket-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!