Operating Systems: i5/OS
             Personalize the table of contents and search results

 

Java Web Start for Application clients

 

This article describes how to use a Java Network Launcher Protocol (JNLP) file statically and dynamically.

 

Overview

To use a static Java Network Launcher Protocol (JNLP) file, you will need to add the following mime type mapping in the web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
       <display-name>
       WAS Client runtime for Java Web Start</display-name>
       <welcome-file-list>
              <welcome-file>index.html</welcome-file>
              <welcome-file>index.htm</welcome-file>
              <welcome-file>index.jsp</welcome-file>
              <welcome-file>default.html</welcome-file>
              <welcome-file>default.htm</welcome-file>
              <welcome-file>default.jsp</welcome-file>
       </welcome-file-list>
       <mime-mapping>
       <extension>jnlp</extension>
       <mime-type>application/x-java-jnlp-file</mime-type>
       </mime-mapping>
</web-app>
Considerations for generating JNLP response dynamically. To generate the JNLP response using a servlet or a Java Server Pages file, the content type of the response header must be set to the JNLP MIME type. For example,

response.setContentType("application/x-java-jnlp-file");
It is recommended to use a servlet instead of a JSP file to generate a dynamic JNLP response. Internet Explorer may not be able to start Java Web Start if the JNLP response generates dynamically using a JSP file because the WebSphere Application Server JSP engine will always append the charset value of ISO-8859-1 to the content type of the response header. That makes the content type to be "application/x-java-jnlp-file;charset=ISO-8859-1" even if it has only been set to "application/x-java-jnlp-file" in the JSP file. The charset value causes Internet Explorer to not be able to recognize it as a valid JNLP response and it will display the content of the JNLP response as clear text.

Other browsers like Firefox and Mozilla are more tolerant with the charset value of the content type in the response. The browsers launch Java Web Start to handle the JNLP response.