Pass dynamic params via JNLP

后端 未结 2 1056
被撕碎了的回忆
被撕碎了的回忆 2020-12-09 12:58

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

I am trying to pass parameters via JavaScript execution to the JNLP and havin

相关标签:
2条回答
  • 2020-12-09 13:23

    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.

    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.

    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>
    
    0 讨论(0)
  • 2020-12-09 13:27

    Are you sure if the response type of the JSP is "application/x-java-jnlp-file"?

    If not, Please mention it at the top of the JSP and check.

    <% response.setContentType("application/x-java-jnlp-file"); %>
    
    0 讨论(0)
提交回复
热议问题