The Digital Cave

Primitive Life in a Technological World

 

Standalone Jetty Setup

While Apache Tomcat tends to be the defacto standard for JSP servers, I personally prefer Jetty for my web pages. Jetty is quite compact, modular, easy to embed in applications, and easy to configure exactly how you desire (even if you are using the standalone version). (Not that Tomcat isn't; both are perfectly viable for any number of applications. I just happen to like Jetty.) This page describes a minimal standalone Jetty installation, specifically for Debian, although it will apply equally for almost any OS.

Installing on Debian

Unfortunately, the Jetty included in Lenny's apt repositories is quite old; thus, I am using a new binary release. First thing we want to do is to trim down the installation to only include the needed files. You should use the following as a guide:

contexts/<context-name>.xml
etc/jetty.xml
etc/webdefault.xml
lib/jetty-<version>.jar
lib/jetty-util-<version>.jar
lib/servlet-api-<version>.jar
lib/ext/jetty-client-<version>/jar
lib/ext/jetty-html-<version>/jar
lib/ext/jetty-java5-threadpool-<version>/jar
lib/ext/jetty-sslengine-<version>/jar
lib/jsp-2.0/*.jar
lib/jsp-2.1/*.jar
start.jar

Your webdefault.xml file can be the default one; change parameters (dirAllowed, etc) as desired. If you want some filters to be included in all contexts, you can add them here. See this sample webdefault file for an example of how this could work.

Likewise, jetty.xml should look something like this.

The context files should look something like this.

As far as installation goes, you can do the following: