简体   繁体   English

Java Applet套接字服务器权限

[英]Java applet socket server permissions

  • I want to make a Java applet, which functions as a socket server (local network ips, or 127 range is fine). 我想制作一个Java applet,它可以用作套接字服务器 (本地网络ips或127范围都可以)。
  • I want this applet to run in a webpage. 我希望此小程序在网页中运行。
  • the browser can ideally load the webpage from the file system (file://...), but I could install an HTTP server if required. 浏览器可以理想地从文件系统(file:// ...)加载网页,但是如果需要,我可以安装HTTP服务器。
  • The applet will need to be able to interact with JavaScript. 小程序将需要能够与JavaScript交互。

I'm having trouble wading through all the docs. 我在遍历所有文档时遇到了麻烦。 Is the above possible? 以上可能吗? I'm not familiar with java's security model. 我不熟悉Java的安全模型。 If I need to sign the applet, or set some special security or configuration settings, that's fine. 如果我需要签署小程序,或设置一些特殊的安全性或配置设置,那很好。

edit- In case anyones curious, the applet does very little. 编辑-万一有人好奇,小程序会做的很少。 I just want to use it as a bridge so that another program running on the local computer can communicate via sockets. 我只想将其用作桥接器,以便本地计算机上运行的另一个程序可以通过套接字进行通信。 That program supplies values, which javascript will use to update the ui in real time. 该程序提供值,javascript将使用这些值实时更新ui。 The ui is complicated, and building it in html/javascript will be a huge time saver. 用户界面很复杂,用html / javascript构建它会节省大量时间。 I'd prefer the applet function as the socket server opposed to a socket client, because otherwise then I need to write a seperate program to act as a server in between the applet and the other program. 我更喜欢applet函数作为套接字服务器而不是套接字客户端,因为否则我需要编写一个单独的程序来充当applet和其他程序之间的服务器。

Is the above possible? 以上可能吗?

Sure. 当然。 If you control the security/policy files for that applet & the firewall, it is a single browser deal, it should be doable. 如果您控制该小程序和防火墙的安全/策略文件,那么这是一个浏览器协议,应该可以实现。 You might need to wrap some of the applet methods in a PrivilegedAction if called from JS. 如果从JS调用,则可能需要将一些applet方法包装在PrivilegedAction

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM