Pass dynamic params via JNLP Pass dynamic params via JNLP apache apache

Pass dynamic params via JNLP


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>


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"); %>