• Post Reply Bookmark Topic Watch Topic
  • New Topic

Returning dynamically generated jnlp from JSF page

 
Ray Muirhead
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is it possible to return content with an arbitrary mime-type (e.g. application/x-java-jnlp-file) from a Java Server Faces page? The purpose is to have a Java Web Start jnlp file dynamically generated using some arguments from the query string, and then to serve it to the user's browser. I understand the generation part ok, but am having a little trouble with serving up the generated text or xml content to the browser.

Thank you
Ray
 
Amit Nair
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ray

It is possible to render a jnlp to client which is created dynamically.
First of all fetch the paramaters values from request which you want to pass dynamically in jnlp. Create a JSP like the one below

<%

String param1 = request.getParameter("paramNameInRequest");

response.setContentType("application/x-java-jnlp-file");
response.setHeader("Expires", "0");
response.setHeader("Content-disposition", "filename=myfile.jnlp");
response.addDateHeader("Date", java.util.Calendar.getInstance().getTime().getTime());
response.addDateHeader("Last-Modified", java.util.Calendar.getInstance().getTime().getTime());

%>



<?xml version="1.0" encoding="utf-8"?>
<jnlp codebase="http://localhost:8080/XXX/myResource" href="myfile.jnlp?param1=<%=param1%>">

<!-- Put your code for jnlp here-->

<application-desc main-class="org.eclipse.core.launcher.WebStartMain">
<argument><%=param1%></argument>
</application-desc>

</jnlp>

Hope this works for you.

Regards
Amit
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!