如何从动态服务器端 URL 加载 Java 小程序?
我想从服务器端脚本加载小程序,例如。 Perl CGI 程序等。这可以完成吗?如何?
<applet code=A21 width=256 height=256 archive="http://url/cgi-bin/test.cgi?R=applet">
预先感谢您的所有帮助。
I want to load an applet from a server side script, eg. a Perl CGI program, etc. Can this be done? how?
<applet code=A21 width=256 height=256 archive="http://url/cgi-bin/test.cgi?R=applet">
thanks in advance for all help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经很长时间没有这样做了(所以安全模型可能已经改变了),但诀窍是配置服务器来处理一些翻译。假设您有 URL:
您设置了 URL 转换,以便使用 CGI 脚本处理 http://example.com/applets,然后获取 /MyCode/1.0 em> 作为
PATH_INFO
。你需要归还什么就归还什么。你为什么要这样做?
I haven't done this is a long time (so the security model might have changed on me), but the trick was to configure the server to handle some translation. Say that you have the URL:
You set up the URL translation such that you handle http://example.com/applets with your CGI script, which then gets /MyCode/1.0 as
PATH_INFO
. You return whatever you need to return.Why do you want to do this?
我能够实现这一点。我使用的机制是将 cgi 脚本文件包装在 shell 脚本中。这个包装器调用 cgi 脚本,然后它将带有特殊请求的原始 URL 嵌入到它作为小程序的页面中。然后该脚本将再次运行并检测此特殊请求。它会在没有任何输出的情况下中断,但会返回一个 shellscript 捕获并输出 jar/classfile 的值。
Fetch.sh
案例 $?在
esac
I was able achived this. The mechanism I used was that the cgi script file was wrapped in a shell script. This wrapper calls the cgi script and it would then then embed the original url with a special request in the page it served as the applet. The script would then get run again and detect this special request. It would break without any output but with a return value that the shellscript would catch and output the jar/classfile.
Fetch.sh
case $? in
esac
来自文档:
,所以我怀疑这会有问题。
From the doc:
so I suspect this will be problematic.