• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • 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
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
 
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
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic