2 Replies Latest reply on Mar 14, 2007 3:19 AM by louise_za

    Generating JNLP file in portlet

    louise_za

      Hi everyone

      I am trying to generate a JNLP file for Java Web Start inside a portlet. In the doView method I have the following:

      rResponse.setContentType("application/x-java-jnlp-file");
      javax.portlet.PortletRequestDispatcher pRD = this.getPortletContext().getRequestDispatcher(JSP_PATH + "/my_jnlp.jsp");


      My jsp contains the following code:
      <%@ page contentType="application/x-java-jnlp-file" %>
      <%@ page session="false"%>
      
      <%
      //get some application variables here
      ...
      ...
      System.out.println("Executing the JSP");
      %>
      
      <jnlp spec="1.0+" codebase="<%=codebase %>">
      
       <information>
       <title>ABC</title>
       <vendor>XYZ</vendor>
       <description>Foo</description>
       </information>
      
       <resources>
       <j2se version="1.5+" />
       <jar href="ABC.jar" />
       </resources>
      
       <applet-desc documentBase="http://<%=web_host %>" name="RST" main-class="MyClass" width="527" height="428">
       <param name="a" value="<%=a_val %>"/>
       <param name="b" value="<%=b_val%>"/>
       </applet-desc>
      
      </jnlp>


      I have added the following to portlet.xml under the appropriate portlet:
      <supports>
       <mime-type>application/x-java-jnlp-file</mime-type>
       <portlet-mode>VIEW</portlet-mode>
      </supports>


      Also, in the web.xml file in jboss-portal-2.2.0-bundled\server\default\deploy\jbossweb-tomcat55.sar\conf, I have added:
      <mime-mapping>
       <extension>jnlp</extension>
       <mime-type>application/x-java-jnlp-file</mime-type>
       </mime-mapping>
       <mime-mapping>
       <extension>jar</extension>
       <mime-type>application/x-java-archive</mime-type>
       </mime-mapping>
       <mime-mapping>
       <extension>jardiff</extension>
       <mime-type>application/x-java-archive-diff</mime-type>
       </mime-mapping>
      


      The problem is that when I open the page that the portlet is on, nothing happens. The portlet does not even get rendered. Please, can anyone help?

        • 1. Re: Generating JNLP file in portlet
          theute

          application/x-java-jnlp-file is not a supported format. You cannot mix text/html and application/x-java-jnlp-file in the same response

          • 2. Re: Generating JNLP file in portlet
            louise_za

            Thanks for the reply!

            Solution to the problem:
            Have the portlet generate a string containing the jnlp content dynamically and write this out to a file at a certain location. Then, have a link inside the portlet pointing to the file - the user will click on it and the java web start sequence will initiate.