• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
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
 
Greenhorn
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.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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic