Fork me on GitHub

Simple JnlpDownloadServlet Example

In this example, we show how to use the plugin to deploy a single JNLP application within a WAR that uses the JnlpDownloadServlet. Only the most basic features are described. For a more complex example that includes multiple JNLP applications in the same WAR, and other more advanced features, see the Advanced JnlpDownloadServlet Example.

The web.xml

The web.xml file of your web application must include the appropriate servlet mapping for the JnlpDownloadServlet as described in the JnlpDownloadServlet Guide. For convenience, a basic but complete example is provided below. Note the url-pattern provided in the servlet-mapping. The Webstart Plugin uses a default value of webstart for the name of the directory that contains the JNLP file and its associated resources.

<?xml version="1.0" encoding="UTF-8"?>
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"




The Plugin Configuration

The sample pom.xml file below shows the configuration for a webstart bundle that contains a single JAR, and generates a JNLP file called launch.jnlp (by default) from a template called clientTemplate.vm.



                  <groupId>[some groupId]</groupId>
                  <artifactId>[some artifactId]</artifactId>
                  <version>[some version]</version>
                  <mainClass>[some main class]</mainClass>