通过传递动态JNLP PARAMS [英] Pass dynamic params via JNLP

查看:558
本文介绍了通过传递动态JNLP PARAMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为了执行JNLP这到底会执行我的客户正在使用的JavaScript。

I am using JavaScript in order to execute JNLP which in the end will execute my client.

我试图通过JavaScript执行到JNLP传递参数,并有我的客户里面通过JNLP的参数。

I am trying to pass parameters via JavaScript execution to the JNLP and having those parameters via JNLP inside my client.

中的JavaScript正在执行这个URL,例如:

The JavaScript is executing this URL for instance:

http://localhost:8080/MyJnlp.jnlp?login=14hhh765p&pass=ggyyktff

现在我的JNLP将努力让参数中的<应用降序排序的名称标签是这样的:

Now my JNLP will try to get the parameters in the <application-desc name tag this way:

<application-desc name="..." main-class="com.main.execute" >
        <argument>-nosplash</argument>
        <argument>-q</argument>
    <argument><%=request.getParameter("login")%></argument>
    <argument><%=request.getParameter("pass")%></argument>
</application-desc>

但它没有工作。

我不能在我的客户端code检索这些参数是这样的:

I couldn't retrieve those parameters in my client code this way:

login=getParamsFromJnlp("login")
..

public String getParamsFromJnlp(String key) {
    return System.getProperty(key);
}

该JNLP里面APACHE2.2

The JNLP is inside APACHE2.2

任何想法有什么不对?

推荐答案

要能够在HTTP参数插入到应用程序的参数,.jnlp文件需要动态地根据要求进行构建,因为它是直到那么你就知道将要使用的HTTP参数。

To be able to insert the http-parameters into the argument of your application, the .jnlp file need to be 'constructed' dynamicly on request, because it is not until then you know which http-parameters that will be used.

Java的Web启动的工作方式是,它会下载的.jnlp几次,但除了第一次将在$ C $继承CBase和JNLP的HREF属性指定的网址下载文件元件。

The way java-web-start works is that it will download the .jnlp several times, but the apart from the first time it will download the file from the url specified in the codebase and href attributes of the jnlp element.

因此​​,它是不够的,在元素添加动态地论证元素,你还需要将它添加到codeBase类/ HREF属性

So it is not enough to add the argument-element dynamicly in the element, you also need to add it to the codebase/href attributes

<jnlp spec="1.0+" 
      codebase=<%=request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ request.getContextPath() + "/" %> 
      href="jnlpfile.jnlp&#063;username=<%=request.getParameter("username")%>&clienttoken=<%=request.getParameter("clienttoken")%>">

    ...
    <application-desc main-class="test.MainClass">
       <argument><%=request.getParameter("username")%></argument>
    </application-desc>
</jnlp>

这篇关于通过传递动态JNLP PARAMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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