Java web-application on Jetty

Installation

1. Open Web Platform Installer and install "Java WAR-file project":

2. Specify path to WAR file in web.config

This Java project uses Jetty (7 or 8) as a servlet container.

Deployment

To deploy Java application you will need to install Java Hosting Package on a target server. Then just copy IIS web site from one machine to another.

web.config example


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <heliconZoo>
      <application name="jetty.project" >
        <environmentVariables>
          <add name="CONTEXT_PATH" value="%APPL_VIRTUAL_PATH%" />
          <add name="WAR_EXTRACT_PATH" value="%APPL_PHYSICAL_PATH%" />
          <add name="WAR_FILE" value="%APPL_PHYSICAL_PATH%\app.war" />
          <add name="PROXYPASS" value="%APPL_VIRTUAL_PATH%" />
        </environmentVariables>
      </application>
    </heliconZoo>
    <handlers>
      <add name="jetty.project#x86" scriptProcessor="java.jetty"  path="*" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
      <add name="jetty.project#x64" scriptProcessor="java.jetty"  path="*" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
    </handlers>
  </system.webServer>
</configuration>

Environment variables:

  • CONTEXTS_DIR — optional path to directory with .xml files which describe Jetty contexts. If this variable isn’t set, Zoo looks for “contexts” folder in the root of application. If no such folder found, Zoo presumes the application has single context and uses variables described below.
  • CONTEXT_PATH — optional virtual path of the application. Default value is taken from APPL_VIRTUAL_PATH variable.
  • WAR_FILE — optional path to a .war file or directory with extracted application.
  • WAR_EXTRACT_PATH — optional .war file extraction path. Is set to application’s root folder by default.