• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Returning dynamically generated jnlp from JSF page

Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.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">


Hope this works for you.

And then we all jump out and yell "surprise! we got you this tiny ad!"
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic