如何使用动态参数启动Java Web Start应用程序 [英] How to launch a Java Web start application with dynamic parameters

查看:213
本文介绍了如何使用动态参数启动Java Web Start应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Java小程序迁移到Java Web Start应用程序.该小程序是通过具有多个参数的JavaScript激活的,其中一些参数不是硬编码的(sessionIdtempFilePath):

I'm trying to migrate a Java applet to a Java web start application. The applet was activated from a JavaScript with several parameters, some are not hard-coded (sessionId, tempFilePath):

deployJava.runApplet(attributes, parameters);

为了迁移小程序,我使用带有applet-desc标签的简单JNLP文件.然后从JavaScript中调用:

In order to migrate the applet I'm using a simple JNLP file with applet-desc tag. And from the JavaScript I call:

deployJava.launchWebStartApplication('$jnlp_path');

我只是不明白如何将JavaScript创建的参数传递给Web Start应用程序.

I just can't understand how to pass to the web start application the parameters that were created by the JavaScript.

推荐答案

确定,因此事实证明,使用deployJava.launchWebStartApplication(...)会触发Chrome和IE中的安全限制.
我所做的工作是解决该问题的方法:我向服务器发送了 HTTP请求,服务器的响应是 JNLP 内容.
在服务器端,我在运行时编辑JNLP,每次插入所需参数时,都进行编辑.
当浏览器收到JNLP内容时,它们会触发所需jar的下载.
就是这样!

OK, so it turns out that using deployJava.launchWebStartApplication(...) triggers security restrictions in Chrome and IE.
What I did is kind of work around: I sent an HTTP request to my server and the server's response was a JNLP content.
On the server side, I edited the JNLP on runtime and each time I inserted the required parameters.
When the browsers receive the JNLP content they trigger the download of the required jar.
And that's it!

这篇关于如何使用动态参数启动Java Web Start应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆