From 8acd4ab72c583ad9bca1607bd30d2cc1017e6e13 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Sun, 9 Aug 2009 23:42:32 +0000 Subject: [PATCH] readded jetty-distribution git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@669 7e9141cc-0065-0410-87d8-b60c137991c4 --- jetty-distribution/pom.xml | 517 +++++++++++++ .../src/main/assembly/jetty-assembly.xml | 19 + .../src/main/assembly/jetty-src.xml | 21 + .../src/main/assembly/site-component.xml | 18 + .../src/main/resources/README.txt | 89 +++ .../resources/bin/README.jetty-cygwin.txt.txt | 11 + .../resources/bin/build_release_bundles.sh | 27 + .../src/main/resources/bin/jetty-cygwin.sh | 677 ++++++++++++++++++ .../src/main/resources/bin/jetty-xinetd.sh | 14 + .../src/main/resources/bin/jetty.sh | 666 +++++++++++++++++ .../resources/contexts-available/README.TXT | 3 + .../src/main/resources/contexts/README.TXT | 15 + .../src/main/resources/contexts/javadoc.xml | 28 + .../src/main/resources/javadoc/contents.html | 7 + .../main/resources/resources/log4j.properties | 9 + 15 files changed, 2121 insertions(+) create mode 100644 jetty-distribution/pom.xml create mode 100644 jetty-distribution/src/main/assembly/jetty-assembly.xml create mode 100644 jetty-distribution/src/main/assembly/jetty-src.xml create mode 100644 jetty-distribution/src/main/assembly/site-component.xml create mode 100644 jetty-distribution/src/main/resources/README.txt create mode 100644 jetty-distribution/src/main/resources/bin/README.jetty-cygwin.txt.txt create mode 100755 jetty-distribution/src/main/resources/bin/build_release_bundles.sh create mode 100755 jetty-distribution/src/main/resources/bin/jetty-cygwin.sh create mode 100755 jetty-distribution/src/main/resources/bin/jetty-xinetd.sh create mode 100755 jetty-distribution/src/main/resources/bin/jetty.sh create mode 100644 jetty-distribution/src/main/resources/contexts-available/README.TXT create mode 100644 jetty-distribution/src/main/resources/contexts/README.TXT create mode 100644 jetty-distribution/src/main/resources/contexts/javadoc.xml create mode 100644 jetty-distribution/src/main/resources/javadoc/contents.html create mode 100644 jetty-distribution/src/main/resources/resources/log4j.properties diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml new file mode 100644 index 00000000000..38569ad8e82 --- /dev/null +++ b/jetty-distribution/pom.xml @@ -0,0 +1,517 @@ + + 4.0.0 + + org.eclipse.jetty + jetty-project + 7.0.0.RC4-SNAPSHOT + + jetty-distribution + Jetty :: Distribution Assemblies + pom + + target/distribution + + + + + maven-resources-plugin + + true + ${assembly.directory} + + + + generate-resources + + resources + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + generate-resources + + run + + + + + + + + + + + + + org.apache.maven.plugins + maven-remote-resources-plugin + + + generate-resources + + process + + + + org.eclipse.jetty.toolchain:jetty-artifact-remote-resources:1.0 + org.eclipse.jetty.toolchain:jetty-distribution-remote-resources:1.1 + + ${assembly.directory} + + + + + + maven-dependency-plugin + 2.1 + + + unpack + generate-resources + + unpack + + + + + org.eclipse.jetty + jetty-rewrite + ${project.version} + config + jar + true + ** + ${assembly.directory} + + + org.eclipse.jetty + jetty-ajp + ${project.version} + config + jar + true + ** + ${assembly.directory} + + + org.eclipse.jetty + test-jetty-webapp + ${project.version} + config + jar + true + ** + ${assembly.directory} + + + org.eclipse.jetty + jetty-jmx + ${project.version} + config + jar + true + ** + ${assembly.directory} + + + org.eclipse.jetty + jetty-util + ${project.version} + config + jar + true + ** + ${assembly.directory} + + + org.eclipse.jetty + jetty-webapp + ${project.version} + config + jar + true + ** + ${assembly.directory} + + + org.eclipse.jetty + jetty-plus + ${project.version} + config + jar + true + ** + ${assembly.directory} + + + org.eclipse.jetty + jetty-server + ${project.version} + config + jar + true + ** + ${assembly.directory} + + + org.eclipse.jetty + jetty-policy + ${project.version} + config + jar + true + ** + ${assembly.directory} + + + + + + copy + generate-resources + + copy + + + + + org.eclipse.jetty + jetty-util + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-io + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-http + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-server + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-security + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-servlet + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-servlets + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-xml + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-webapp + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-deploy + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-jmx + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-rewrite + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-ajp + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-annotations + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-client + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-jndi + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-policy + ${project.version} + jar + true + ** + ${assembly.directory}/lib/security + + + org.eclipse.jetty + jetty-plus + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + jetty-continuation + ${project.version} + jar + true + ** + ${assembly.directory}/lib + + + org.eclipse.jetty + test-jetty-webapp + ${project.version} + war + true + ** + ${assembly.directory}/webapps + test.war + + + org.eclipse.jetty + jetty-start + ${project.version} + jar + true + ** + ${assembly.directory} + start.jar + + + + + + generate-resources + + copy + + + + + javax.mail + mail + ${mail-version} + ${assembly.directory}/lib/jetty-jndi + + + javax.activation + activation + ${activation-version} + ${assembly.directory}/lib/jetty-jndi + + + org.apache.geronimo.specs + geronimo-annotation_1.0_spec + 1.1.1 + ${assembly.directory}/lib/jetty-annotations + + + asm + asm-commons + 3.1 + ${assembly.directory}/lib/jetty-annotations + + + asm + asm + 3.1 + ${assembly.directory}/lib/jetty-annotations + + + asm + asm-tree + 3.1 + ${assembly.directory}/lib/jetty-annotations + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + src/main/assembly/jetty-assembly.xml + + gnu + + + + package + + single + + + + + + + + + org.eclipse.jetty + jetty-deploy + ${project.version} + + + org.eclipse.jetty + jetty-rewrite + ${project.version} + + + org.eclipse.jetty + jetty-ajp + ${project.version} + + + org.eclipse.jetty + jetty-annotations + ${project.version} + + + org.eclipse.jetty + test-jetty-webapp + war + ${project.version} + + + org.eclipse.jetty + jetty-jmx + ${project.version} + + + org.eclipse.jetty + jetty-jndi + ${project.version} + + + org.eclipse.jetty + jetty-plus + ${project.version} + + + org.eclipse.jetty + jetty-client + ${project.version} + + + org.eclipse.jetty + jetty-continuation + ${project.version} + + + org.eclipse.jetty + jetty-start + ${project.version} + + + org.eclipse.jetty + jetty-policy + ${project.version} + + + + diff --git a/jetty-distribution/src/main/assembly/jetty-assembly.xml b/jetty-distribution/src/main/assembly/jetty-assembly.xml new file mode 100644 index 00000000000..d80049535f5 --- /dev/null +++ b/jetty-distribution/src/main/assembly/jetty-assembly.xml @@ -0,0 +1,19 @@ + + + tar.gz + tar.bz2 + zip + + + + ${assembly.directory} + + + ** + + + *-config.jar + + + + diff --git a/jetty-distribution/src/main/assembly/jetty-src.xml b/jetty-distribution/src/main/assembly/jetty-src.xml new file mode 100644 index 00000000000..b1b6bd8ca82 --- /dev/null +++ b/jetty-distribution/src/main/assembly/jetty-src.xml @@ -0,0 +1,21 @@ + + src + + tar.gz + tar.bz2 + zip + + + + ${basedir}/target/dist-src + + + ** + + + **/target/** + **/.svn/** + + + + diff --git a/jetty-distribution/src/main/assembly/site-component.xml b/jetty-distribution/src/main/assembly/site-component.xml new file mode 100644 index 00000000000..c87eab9547d --- /dev/null +++ b/jetty-distribution/src/main/assembly/site-component.xml @@ -0,0 +1,18 @@ + + site-component + + jar + + + + ${basedir}/target/dist-src + jetty-distribution-${version}-site-component + + target/site/** + README** + VERSION** + LICENSES/** + + + + \ No newline at end of file diff --git a/jetty-distribution/src/main/resources/README.txt b/jetty-distribution/src/main/resources/README.txt new file mode 100644 index 00000000000..57a7c49581e --- /dev/null +++ b/jetty-distribution/src/main/resources/README.txt @@ -0,0 +1,89 @@ + +JETTY +===== + +The Jetty project is a 100% Java HTTP Server, HTTP Client +and Servlet Container. The core project is hosted by +the Eclipse Foundation at + + http://www.eclipse.org/jetty/ + +The jetty integrations with 3rd party modules are hosted +by the Codehaus at + + http://jetty.codehaus.org + + +JETTY DISTRIBUTION +================== + +This is the jetty-distribution module from Jetty @ eclipse +project is based on the Jetty modules from eclipse plus +dependencies that have been through the eclipse IP +process and conditioning. + +This distribution and it's dependencies are provided under +the terms and conditions of the Eclipse Foundation Software +User Agreement unless otherwise specified. + +This distribution contains only the core functionality +of a servlet server and the HTTP client. + +Some modules (eg annotations) are missing dependencies +which may be discovered by using the command + mvn dependency:tree +within the source module and placing them in the +lib/ext directory. + + +JETTY HIGHTIDE +============== + +The Jetty-hightide distribution is available for +download via http://jetty.codehaus.org and contains +the core jetty modules, plus the 3rd party dependencies +and integrations needed to create a full featured +application server. + + +MAVEN +===== +All Jetty artefacts are available as maven dependencies +under the org.eclipse.jetty and org.mortbay.hightide group IDs + + http://repo1.maven.org/maven2/org/eclipse/jetty/ + http://repo2.maven.org/maven2/org/mortbay/jetty/ + + +RUNNING JETTY +============= + +The run directory is either the top-level of a distribution +or jetty-distribution/target/distribution directory when built from +source. + +To run with the default options: + + java -jar start.jar + +To run with specific configuration file(s) + + java -jar start.jar etc/jetty.xml + +To see the available options + + java -jar start.jar --help + +To run with JSP support (if available) + + java -jar start.jar OPTIONS=Server,jsp + +To run with JMX support + + java -jar start.jar OPTIONS=Server,jmx etc/jetty-jmx.xml etc/jetty.xml + +To run with JSP & JMX support + + java -jar start.jar OPTIONS=Server,jsp,jmx etc/jetty-jmx.xml etc/jetty.xml + + diff --git a/jetty-distribution/src/main/resources/bin/README.jetty-cygwin.txt.txt b/jetty-distribution/src/main/resources/bin/README.jetty-cygwin.txt.txt new file mode 100644 index 00000000000..6ac050de58e --- /dev/null +++ b/jetty-distribution/src/main/resources/bin/README.jetty-cygwin.txt.txt @@ -0,0 +1,11 @@ +Before running jetty-cygwin.sh on cygwin, define the JAVA_HOME and JETTY_HOME first. + +$ export JAVA_HOME=/path/to/jvm +$ export JETTY_HOME=/path/to/jetty + +Examples: +$ export JAVA_HOME=/usr/bin/jvm +So assuming you installed cygwin on C:\cygwin, the jvm needs to be in C:\cygwin\usr\bin\jvm + +$ export JETTY_HOME=/usr/share/jetty6 +So assuming you installed cygwin on C:\cygwin, jetty needs to be in C:\cygwin\usr\share\jetty6 \ No newline at end of file diff --git a/jetty-distribution/src/main/resources/bin/build_release_bundles.sh b/jetty-distribution/src/main/resources/bin/build_release_bundles.sh new file mode 100755 index 00000000000..a9a2187026c --- /dev/null +++ b/jetty-distribution/src/main/resources/bin/build_release_bundles.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +[ $# -eq 1 ] || { echo "Usage - $0 jetty-dir" >&2 ; exit 1 ; } + +cd $1 +D=$(pwd) +N=$(basename $D) +D=$(dirname $D) +cd $D + + find $N -type f |\ + egrep -v /\\.svn |\ + egrep -v /target |\ + egrep -v /\\. |\ + egrep -v $N/start.jar |\ + egrep -v $N/lib |\ + egrep -v $N/logs |\ + egrep -v $N/webapp |\ + egrep -v $N/javadoc |\ + xargs zip $D/$N-src.zip $N/logs + + find $N -type f |\ + egrep -v /\\.svn |\ + egrep -v /target |\ + egrep -v /\\. |\ + egrep -v $N/logs |\ + xargs zip $D/$N.zip $N/logs diff --git a/jetty-distribution/src/main/resources/bin/jetty-cygwin.sh b/jetty-distribution/src/main/resources/bin/jetty-cygwin.sh new file mode 100755 index 00000000000..550390edce1 --- /dev/null +++ b/jetty-distribution/src/main/resources/bin/jetty-cygwin.sh @@ -0,0 +1,677 @@ +#!/bin/bash +# +# Startup script for jetty under *nix systems (it works under NT/cygwin too). + +# To get the service to restart correctly on reboot, uncomment below (3 lines): +# ======================== +# chkconfig: 3 99 99 +# description: Jetty 7 webserver +# processname: jetty +# ======================== + +# Configuration files +# +# /etc/default/jetty +# If it exists, this is read at the start of script. It may perform any +# sequence of shell commands, like setting relevant environment variables. +# +# $HOME/.jettyrc +# If it exists, this is read at the start of script. It may perform any +# sequence of shell commands, like setting relevant environment variables. +# +# /etc/jetty.conf +# If found, and no configurations were given on the command line, +# the file will be used as this script's configuration. +# Each line in the file may contain: +# - A comment denoted by the pound (#) sign as first non-blank character. +# - The path to a regular file, which will be passed to jetty as a +# config.xml file. +# - The path to a directory. Each *.xml file in the directory will be +# passed to jetty as a config.xml file. +# +# The files will be checked for existence before being passed to jetty. +# +# $JETTY_HOME/etc/jetty.xml +# If found, used as this script's configuration file, but only if +# /etc/jetty.conf was not present. See above. +# +# Configuration variables +# +# JAVA_HOME +# Home of Java installation. +# +# JAVA +# Command to invoke Java. If not set, $JAVA_HOME/bin/java will be +# used. +# +# JAVA_OPTIONS +# Extra options to pass to the JVM +# +# JETTY_HOME +# Where Jetty is installed. If not set, the script will try go +# guess it by first looking at the invocation path for the script, +# and then by looking in standard locations as $HOME/opt/jetty +# and /opt/jetty. The java system property "jetty.home" will be +# set to this value for use by configure.xml files, f.e.: +# +# /webapps/jetty.war +# +# JETTY_PORT +# Override the default port for Jetty servers. If not set then the +# default value in the xml configuration file will be used. The java +# system property "jetty.port" will be set to this value for use in +# configure.xml files. For example, the following idiom is widely +# used in the demo config files to respect this property in Listener +# configuration elements: +# +# +# +# Note: that the config file could ignore this property simply by saying: +# +# 8080 +# +# JETTY_RUN +# Where the jetty.pid file should be stored. It defaults to the +# first available of /var/run, /usr/var/run, and /tmp if not set. +# +# JETTY_PID +# The Jetty PID file, defaults to $JETTY_RUN/jetty.pid +# +# JETTY_ARGS +# The default arguments to pass to jetty. +# +# JETTY_USER +# if set, then used as a username to run the server as +# + +usage() +{ + echo "Usage: $0 {start|stop|run|restart|check|supervise} [ CONFIGS ... ] " + exit 1 +} + +[ $# -gt 0 ] || usage + + +################################################## +# Some utility functions +################################################## +findDirectory() +{ + OP=$1 + shift + for L in $* ; do + [ $OP $L ] || continue + echo $L + break + done +} + +running() +{ + [ -f $1 ] || return 1 + PID=$(cat $1) + ps -p $PID >/dev/null 2>/dev/null || return 1 + return 0 +} + + + + + + + +################################################## +# Get the action & configs +################################################## + +ACTION=$1 +shift +ARGS="$*" +CONFIGS="" +NO_START=0 + +################################################## +# See if there's a default configuration file +################################################## +if [ -f /etc/default/jetty7 ] ; then + . /etc/default/jetty7 +elif [ -f /etc/default/jetty ] ; then + . /etc/default/jetty +fi + + +################################################## +# See if there's a user-specific configuration file +################################################## +if [ -f $HOME/.jettyrc ] ; then + . $HOME/.jettyrc +fi + +################################################## +# Set tmp if not already set. +################################################## + +if [ -z "$TMP" ] +then + TMP=/tmp +fi + +################################################## +# Jetty's hallmark +################################################## +JETTY_INSTALL_TRACE_FILE="etc/jetty.xml" +TMPJ=$TMP/j$$ + + +################################################## +# Try to determine JETTY_HOME if not set +################################################## +if [ -z "$JETTY_HOME" ] +then + JETTY_HOME_1=`dirname "$0"` + JETTY_HOME_1=`dirname "$JETTY_HOME_1"` + if [ -f "${JETTY_HOME_1}/${JETTY_INSTALL_TRACE_FILE}" ] ; + then + JETTY_HOME=${JETTY_HOME_1} + fi +fi + + +################################################## +# if no JETTY_HOME, search likely locations. +################################################## +if [ "$JETTY_HOME" = "" ] ; then + STANDARD_LOCATIONS=" \ + /usr/share \ + /usr/share/java \ + $HOME \ + $HOME/src \ + ${HOME}/opt/ \ + /opt \ + /java \ + /usr/local \ + /usr/local/share \ + /usr/local/share/java \ + /home \ + " + JETTY_DIR_NAMES=" \ + jetty-7 \ + jetty7 \ + jetty-7.* \ + jetty \ + Jetty-7 \ + Jetty7 \ + Jetty-7.* \ + Jetty \ + " + + JETTY_HOME= + for L in $STANDARD_LOCATIONS + do + for N in $JETTY_DIR_NAMES + do + if [ -d $L/$N ] && [ -f "$L/${N}/${JETTY_INSTALL_TRACE_FILE}" ] ; + then + JETTY_HOME="$L/$N" + fi + done + [ ! -z "$JETTY_HOME" ] && break + done +fi + + +################################################## +# No JETTY_HOME yet? We're out of luck! +################################################## +if [ -z "$JETTY_HOME" ] ; then + echo "** ERROR: JETTY_HOME not set, you need to set it or install in a standard location" + exit 1 +fi + +cd $JETTY_HOME +JETTY_HOME=`pwd` + + +##################################################### +# Check that jetty is where we think it is +##################################################### +if [ ! -r $JETTY_HOME/$JETTY_INSTALL_TRACE_FILE ] +then + echo "** ERROR: Oops! Jetty doesn't appear to be installed in $JETTY_HOME" + echo "** ERROR: $JETTY_HOME/$JETTY_INSTALL_TRACE_FILE is not readable!" + exit 1 +fi + + +########################################################### +# Get the list of config.xml files from the command line. +########################################################### +if [ ! -z "$ARGS" ] +then + for A in $ARGS + do + if [ -f $A ] + then + CONF="$A" + elif [ -f $JETTY_HOME/etc/$A ] + then + CONF="$JETTY_HOME/etc/$A" + elif [ -f ${A}.xml ] + then + CONF="${A}.xml" + elif [ -f $JETTY_HOME/etc/${A}.xml ] + then + CONF="$JETTY_HOME/etc/${A}.xml" + else + echo "** ERROR: Cannot find configuration '$A' specified in the command line." + exit 1 + fi + if [ ! -r $CONF ] + then + echo "** ERROR: Cannot read configuration '$A' specified in the command line." + exit 1 + fi + CONFIGS="$CONFIGS $CONF" + done +fi + + +################################################## +# Try to find this script's configuration file, +# but only if no configurations were given on the +# command line. +################################################## +if [ -z "$JETTY_CONF" ] +then + if [ -f /etc/jetty.conf ] + then + JETTY_CONF=/etc/jetty.conf + elif [ -f "${JETTY_HOME}/etc/jetty.conf" ] + then + JETTY_CONF="${JETTY_HOME}/etc/jetty.conf" + fi +fi + +################################################## +# Read the configuration file if one exists +################################################## +CONFIG_LINES= +if [ -z "$CONFIGS" ] && [ -f "$JETTY_CONF" ] && [ -r "$JETTY_CONF" ] +then + CONFIG_LINES=`cat $JETTY_CONF | grep -v "^[:space:]*#" | tr "\n" " "` +fi + +################################################## +# Get the list of config.xml files from jetty.conf +################################################## +if [ ! -z "${CONFIG_LINES}" ] +then + for CONF in ${CONFIG_LINES} + do + if [ ! -r "$CONF" ] + then + echo "** WARNING: Cannot read '$CONF' specified in '$JETTY_CONF'" + elif [ -f "$CONF" ] + then + # assume it's a configure.xml file + CONFIGS="$CONFIGS $CONF" + elif [ -d "$CONF" ] + then + # assume it's a directory with configure.xml files + # for example: /etc/jetty.d/ + # sort the files before adding them to the list of CONFIGS + XML_FILES=`ls ${CONF}/*.xml | sort | tr "\n" " "` + for FILE in ${XML_FILES} + do + if [ -r "$FILE" ] && [ -f "$FILE" ] + then + CONFIGS="$CONFIGS $FILE" + else + echo "** WARNING: Cannot read '$FILE' specified in '$JETTY_CONF'" + fi + done + else + echo "** WARNING: Don''t know what to do with '$CONF' specified in '$JETTY_CONF'" + fi + done +fi + +##################################################### +# Run the standard server if there's nothing else to run +##################################################### +if [ -z "$CONFIGS" ] +then + CONFIGS="${JETTY_HOME}/etc/jetty-logging.xml ${JETTY_HOME}/etc/jetty.xml" +fi + + +##################################################### +# Find a location for the pid file +##################################################### +if [ -z "$JETTY_RUN" ] +then + JETTY_RUN=`findDirectory -w /var/run /usr/var/run /tmp` +fi + +##################################################### +# Find a PID for the pid file +##################################################### +if [ -z "$JETTY_PID" ] +then + JETTY_PID="$JETTY_RUN/jetty.pid" +fi + + +################################################## +# Check for JAVA_HOME +################################################## +if [ -z "$JAVA_HOME" ] +then + # If a java runtime is not defined, search the following + # directories for a JVM and sort by version. Use the highest + # version number. + + # Java search path + JAVA_LOCATIONS="\ + /usr/java \ + /usr/bin \ + /usr/local/bin \ + /usr/local/java \ + /usr/local/jdk \ + /usr/local/jre \ + /usr/lib/jvm \ + /opt/java \ + /opt/jdk \ + /opt/jre \ + " + JAVA_NAMES="java jdk jre" + for N in $JAVA_NAMES ; do + for L in $JAVA_LOCATIONS ; do + [ -d $L ] || continue + find $L -name "$N" ! -type d | grep -v threads | while read J ; do + [ -x $J ] || continue + VERSION=`eval $J -version 2>&1` + [ $? = 0 ] || continue + VERSION=`expr "$VERSION" : '.*"\(1.[0-9\.]*\)["_]'` + [ "$VERSION" = "" ] && continue + expr $VERSION \< 1.2 >/dev/null && continue + echo $VERSION:$J + done + done + done | sort | tail -1 > $TMPJ + JAVA=`cat $TMPJ | cut -d: -f2` + JVERSION=`cat $TMPJ | cut -d: -f1` + + JAVA_HOME=`dirname $JAVA` + while [ ! -z "$JAVA_HOME" -a "$JAVA_HOME" != "/" -a ! -f "$JAVA_HOME/lib/tools.jar" ] ; do + JAVA_HOME=`dirname $JAVA_HOME` + done + [ "$JAVA_HOME" = "" ] && JAVA_HOME= + + echo "Found JAVA=$JAVA in JAVA_HOME=$JAVA_HOME" +fi + + +################################################## +# Determine which JVM of version >1.2 +# Try to use JAVA_HOME +################################################## +if [ "$JAVA" = "" -a "$JAVA_HOME" != "" ] +then + if [ ! -z "$JAVACMD" ] + then + JAVA="$JAVACMD" + else + [ -x $JAVA_HOME/bin/jre -a ! -d $JAVA_HOME/bin/jre ] && JAVA=$JAVA_HOME/bin/jre + [ -x $JAVA_HOME/bin/java -a ! -d $JAVA_HOME/bin/java ] && JAVA=$JAVA_HOME/bin/java + fi +fi + +if [ "$JAVA" = "" ] +then + echo "Cannot find a JRE or JDK. Please set JAVA_HOME to a >=1.2 JRE" 2>&2 + exit 1 +fi + +JAVA_VERSION=`expr "$($JAVA -version 2>&1 | head -1)" : '.*1\.\([0-9]\)'` + +##################################################### +# See if JETTY_PORT is defined +##################################################### +if [ "$JETTY_PORT" != "" ] +then + JAVA_OPTIONS="$JAVA_OPTIONS -Djetty.port=$JETTY_PORT" +fi + +##################################################### +# See if JETTY_LOGS is defined +##################################################### +if [ "$JETTY_LOGS" != "" ] +then + JAVA_OPTIONS="$JAVA_OPTIONS -Djetty.logs=$JETTY_LOGS" +fi + +##################################################### +# Are we running on Windows? Could be, with Cygwin/NT. +##################################################### +case "`uname`" in +CYGWIN*) PATH_SEPARATOR=";";; +*) PATH_SEPARATOR=":";; +esac + + +##################################################### +# Add jetty properties to Java VM options. +##################################################### +JAVA_OPTIONS="$JAVA_OPTIONS -Djetty.home=$JETTY_HOME -Djava.io.tmpdir=$TMP" + +[ -f $JETTY_HOME/etc/start.config ] && JAVA_OPTIONS="-DSTART=$JETTY_HOME/etc/start.config $JAVA_OPTIONS" + +##################################################### +# This is how the Jetty server will be started +##################################################### + +JETTY_START=$JETTY_HOME/start.jar +[ ! -f $JETTY_START ] && JETTY_START=$JETTY_HOME/lib/start.jar + +case "`uname`" in +CYGWIN*) +JETTY_START="`cygpath -w $JETTY_START`" +echo $JETTY_START + +CONFIGS="`cygpath -w $CONFIGS`" +echo $CONFIGS +;; +esac + + +RUN_ARGS="$JAVA_OPTIONS -jar $JETTY_START $JETTY_ARGS $CONFIGS" +RUN_CMD="$JAVA $RUN_ARGS" + +##################################################### +# Comment these out after you're happy with what +# the script is doing. +##################################################### +#echo "JETTY_HOME = $JETTY_HOME" +#echo "JETTY_CONF = $JETTY_CONF" +#echo "JETTY_RUN = $JETTY_RUN" +#echo "JETTY_PID = $JETTY_PID" +#echo "JETTY_ARGS = $JETTY_ARGS" +#echo "CONFIGS = $CONFIGS" +#echo "JAVA_OPTIONS = $JAVA_OPTIONS" +#echo "JAVA = $JAVA" + + +################################################## +# Do the action +################################################## +case "$ACTION" in + start) + echo -n "Starting Jetty: " + + if [ "$NO_START" = "1" ]; then + echo "Not starting jetty - NO_START=1 in /etc/default/jetty7"; + exit 0; + fi + + + if [ "$START_STOP_DAEMON" = "1" ] && type start-stop-daemon > /dev/null 2>&1 + then + [ x$JETTY_USER = x ] && JETTY_USER=$(whoami) + [ $UID = 0 ] && CH_USER="-c $JETTY_USER" + if start-stop-daemon -S -p$JETTY_PID $CH_USER -d $JETTY_HOME -b -m -a $JAVA -- $RUN_ARGS + then + sleep 1 + if running $JETTY_PID + then + echo OK + else + echo FAILED + fi + fi + + else + + if [ -f $JETTY_PID ] + then + if running $JETTY_PID + then + echo "Already Running!!" + exit 1 + else + # dead pid file - remove + rm -f $JETTY_PID + fi + fi + + if [ x$JETTY_USER != x ] + then + touch $JETTY_PID + chown $JETTY_USER $JETTY_PID + su - $JETTY_USER -c " + $RUN_CMD & + PID=\$! + disown \$PID + echo \$PID > $JETTY_PID" + else + $RUN_CMD & + PID=$! + disown $PID + echo $PID > $JETTY_PID + fi + + echo "STARTED Jetty `date`" + fi + + ;; + + stop) + echo -n "Stopping Jetty: " + if [ "$START_STOP_DAEMON" = "1" ] && type start-stop-daemon > /dev/null 2>&1; then + start-stop-daemon -K -p $JETTY_PID -d $JETTY_HOME -a $JAVA -s HUP + sleep 1 + if running $JETTY_PID + then + sleep 3 + if running $JETTY_PID + then + sleep 30 + if running $JETTY_PID + then + start-stop-daemon -K -p $JETTY_PID -d $JETTY_HOME -a $JAVA -s KILL + fi + fi + fi + + rm -f $JETTY_PID + echo OK + else + PID=`cat $JETTY_PID 2>/dev/null` + TIMEOUT=30 + while running $JETTY_PID && [ $TIMEOUT -gt 0 ] + do + kill $PID 2>/dev/null + sleep 1 + let TIMEOUT=$TIMEOUT-1 + done + + [ $TIMEOUT -gt 0 ] || kill -9 $PID 2>/dev/null + + rm -f $JETTY_PID + echo OK + fi + ;; + + restart) + JETTY_SH=$0 + if [ ! -f $JETTY_SH ]; then + if [ ! -f $JETTY_HOME/bin/jetty.sh ]; then + echo "$JETTY_HOME/bin/jetty.sh does not exist." + exit 1 + fi + JETTY_SH=$JETTY_HOME/bin/jetty.sh + fi + $JETTY_SH stop $* + sleep 5 + $JETTY_SH start $* + ;; + + supervise) + # + # Under control of daemontools supervise monitor which + # handles restarts and shutdowns via the svc program. + # + exec $RUN_CMD + ;; + + run|demo) + echo "Running Jetty: " + + if [ -f $JETTY_PID ] + then + if running $JETTY_PID + then + echo "Already Running!!" + exit 1 + else + # dead pid file - remove + rm -f $JETTY_PID + fi + fi + + exec $RUN_CMD + ;; + + check) + echo "Checking arguments to Jetty: " + echo "JETTY_HOME = $JETTY_HOME" + echo "JETTY_CONF = $JETTY_CONF" + echo "JETTY_RUN = $JETTY_RUN" + echo "JETTY_PID = $JETTY_PID" + echo "JETTY_PORT = $JETTY_PORT" + echo "JETTY_LOGS = $JETTY_LOGS" + echo "CONFIGS = $CONFIGS" + echo "JAVA_OPTIONS = $JAVA_OPTIONS" + echo "JAVA = $JAVA" + echo "CLASSPATH = $CLASSPATH" + echo "RUN_CMD = $RUN_CMD" + echo + + if [ -f $JETTY_RUN/jetty.pid ] + then + echo "Jetty running pid="`cat $JETTY_RUN/jetty.pid` + exit 0 + fi + exit 1 + ;; + +*) + usage + ;; +esac + +exit 0 + + + diff --git a/jetty-distribution/src/main/resources/bin/jetty-xinetd.sh b/jetty-distribution/src/main/resources/bin/jetty-xinetd.sh new file mode 100755 index 00000000000..f74b932d659 --- /dev/null +++ b/jetty-distribution/src/main/resources/bin/jetty-xinetd.sh @@ -0,0 +1,14 @@ +#!/bin/bash + + +# look for JETTY_HOME +if [ -z "$JETTY_HOME" ] +then + JETTY_HOME_1=`dirname "$0"` + JETTY_HOME_1=`dirname "$JETTY_HOME_1"` + JETTY_HOME=${JETTY_HOME_1} +fi + +cd $JETTY_HOME +exec /usr/bin/java -Djetty.port=8088 -jar start.jar etc/jetty.xml etc/jetty-xinetd.xml + diff --git a/jetty-distribution/src/main/resources/bin/jetty.sh b/jetty-distribution/src/main/resources/bin/jetty.sh new file mode 100755 index 00000000000..5c3fda5f785 --- /dev/null +++ b/jetty-distribution/src/main/resources/bin/jetty.sh @@ -0,0 +1,666 @@ +#!/bin/bash +# +# Startup script for jetty under *nix systems (it works under NT/cygwin too). + +# To get the service to restart correctly on reboot, uncomment below (3 lines): +# ======================== +# chkconfig: 3 99 99 +# description: Jetty 7 webserver +# processname: jetty +# ======================== + +# Configuration files +# +# /etc/default/jetty +# If it exists, this is read at the start of script. It may perform any +# sequence of shell commands, like setting relevant environment variables. +# +# $HOME/.jettyrc +# If it exists, this is read at the start of script. It may perform any +# sequence of shell commands, like setting relevant environment variables. +# +# /etc/jetty.conf +# If found, and no configurations were given on the command line, +# the file will be used as this script's configuration. +# Each line in the file may contain: +# - A comment denoted by the pound (#) sign as first non-blank character. +# - The path to a regular file, which will be passed to jetty as a +# config.xml file. +# - The path to a directory. Each *.xml file in the directory will be +# passed to jetty as a config.xml file. +# +# The files will be checked for existence before being passed to jetty. +# +# $JETTY_HOME/etc/jetty.xml +# If found, used as this script's configuration file, but only if +# /etc/jetty.conf was not present. See above. +# +# Configuration variables +# +# JAVA_HOME +# Home of Java installation. +# +# JAVA +# Command to invoke Java. If not set, $JAVA_HOME/bin/java will be +# used. +# +# JAVA_OPTIONS +# Extra options to pass to the JVM +# +# JETTY_HOME +# Where Jetty is installed. If not set, the script will try go +# guess it by first looking at the invocation path for the script, +# and then by looking in standard locations as $HOME/opt/jetty +# and /opt/jetty. The java system property "jetty.home" will be +# set to this value for use by configure.xml files, f.e.: +# +# /webapps/jetty.war +# +# JETTY_PORT +# Override the default port for Jetty servers. If not set then the +# default value in the xml configuration file will be used. The java +# system property "jetty.port" will be set to this value for use in +# configure.xml files. For example, the following idiom is widely +# used in the demo config files to respect this property in Listener +# configuration elements: +# +# +# +# Note: that the config file could ignore this property simply by saying: +# +# 8080 +# +# JETTY_RUN +# Where the jetty.pid file should be stored. It defaults to the +# first available of /var/run, /usr/var/run, and /tmp if not set. +# +# JETTY_PID +# The Jetty PID file, defaults to $JETTY_RUN/jetty.pid +# +# JETTY_ARGS +# The default arguments to pass to jetty. +# +# JETTY_USER +# if set, then used as a username to run the server as +# +# Set to 0 if you do not want to use start-stop-daemon (especially on SUSE boxes) +START_STOP_DAEMON=1 + +usage() +{ + echo "Usage: $0 {start|stop|run|restart|check|supervise} [ CONFIGS ... ] " + exit 1 +} + +[ $# -gt 0 ] || usage + + +################################################## +# Some utility functions +################################################## +findDirectory() +{ + OP=$1 + shift + for L in $* ; do + [ $OP $L ] || continue + echo $L + break + done +} + +running() +{ + [ -f $1 ] || return 1 + PID=$(cat $1) + ps -p $PID >/dev/null 2>/dev/null || return 1 + return 0 +} + + + + + + + +################################################## +# Get the action & configs +################################################## + +ACTION=$1 +shift +ARGS="$*" +CONFIGS="" +NO_START=0 + +################################################## +# See if there's a default configuration file +################################################## +if [ -f /etc/default/jetty7 ] ; then + . /etc/default/jetty7 +elif [ -f /etc/default/jetty ] ; then + . /etc/default/jetty +fi + + +################################################## +# See if there's a user-specific configuration file +################################################## +if [ -f $HOME/.jettyrc ] ; then + . $HOME/.jettyrc +fi + +################################################## +# Set tmp if not already set. +################################################## + +if [ -z "$TMP" ] +then + TMP=/tmp +fi + +################################################## +# Jetty's hallmark +################################################## +JETTY_INSTALL_TRACE_FILE="etc/jetty.xml" +TMPJ=$TMP/j$$ + + +################################################## +# Try to determine JETTY_HOME if not set +################################################## +if [ -z "$JETTY_HOME" ] +then + JETTY_HOME_1=`dirname "$0"` + JETTY_HOME_1=`dirname "$JETTY_HOME_1"` + if [ -f "${JETTY_HOME_1}/${JETTY_INSTALL_TRACE_FILE}" ] ; + then + JETTY_HOME=${JETTY_HOME_1} + fi +fi + + +################################################## +# if no JETTY_HOME, search likely locations. +################################################## +if [ "$JETTY_HOME" = "" ] ; then + STANDARD_LOCATIONS=" \ + /usr/share \ + /usr/share/java \ + $HOME \ + $HOME/src \ + ${HOME}/opt/ \ + /opt \ + /java \ + /usr/local \ + /usr/local/share \ + /usr/local/share/java \ + /home \ + " + JETTY_DIR_NAMES=" \ + jetty-7 \ + jetty7 \ + jetty-7.* \ + jetty \ + Jetty-7 \ + Jetty7 \ + Jetty-7.* \ + Jetty \ + " + + JETTY_HOME= + for L in $STANDARD_LOCATIONS + do + for N in $JETTY_DIR_NAMES + do + if [ -d $L/$N ] && [ -f "$L/${N}/${JETTY_INSTALL_TRACE_FILE}" ] ; + then + JETTY_HOME="$L/$N" + fi + done + [ ! -z "$JETTY_HOME" ] && break + done +fi + + +################################################## +# No JETTY_HOME yet? We're out of luck! +################################################## +if [ -z "$JETTY_HOME" ] ; then + echo "** ERROR: JETTY_HOME not set, you need to set it or install in a standard location" + exit 1 +fi +cd $JETTY_HOME +JETTY_HOME=`pwd` + +##################################################### +# Check that jetty is where we think it is +##################################################### +if [ ! -r $JETTY_HOME/$JETTY_INSTALL_TRACE_FILE ] +then + echo "** ERROR: Oops! Jetty doesn't appear to be installed in $JETTY_HOME" + echo "** ERROR: $JETTY_HOME/$JETTY_INSTALL_TRACE_FILE is not readable!" + exit 1 +fi + + +########################################################### +# Get the list of config.xml files from the command line. +########################################################### +if [ ! -z "$ARGS" ] +then + for A in $ARGS + do + if [ -f $A ] + then + CONF="$A" + elif [ -f $JETTY_HOME/etc/$A ] + then + CONF="$JETTY_HOME/etc/$A" + elif [ -f ${A}.xml ] + then + CONF="${A}.xml" + elif [ -f $JETTY_HOME/etc/${A}.xml ] + then + CONF="$JETTY_HOME/etc/${A}.xml" + else + echo "** ERROR: Cannot find configuration '$A' specified in the command line." + exit 1 + fi + if [ ! -r $CONF ] + then + echo "** ERROR: Cannot read configuration '$A' specified in the command line." + exit 1 + fi + CONFIGS="$CONFIGS $CONF" + done +fi + + +################################################## +# Try to find this script's configuration file, +# but only if no configurations were given on the +# command line. +################################################## +if [ -z "$JETTY_CONF" ] +then + if [ -f /etc/jetty.conf ] + then + JETTY_CONF=/etc/jetty.conf + elif [ -f "${JETTY_HOME}/etc/jetty.conf" ] + then + JETTY_CONF="${JETTY_HOME}/etc/jetty.conf" + fi +fi + +################################################## +# Read the configuration file if one exists +################################################## +CONFIG_LINES= +if [ -z "$CONFIGS" ] && [ -f "$JETTY_CONF" ] && [ -r "$JETTY_CONF" ] +then + CONFIG_LINES=`cat $JETTY_CONF | grep -v "^[:space:]*#" | tr "\n" " "` +fi + +################################################## +# Get the list of config.xml files from jetty.conf +################################################## +if [ ! -z "${CONFIG_LINES}" ] +then + for CONF in ${CONFIG_LINES} + do + if [ ! -r "$CONF" ] + then + echo "** WARNING: Cannot read '$CONF' specified in '$JETTY_CONF'" + elif [ -f "$CONF" ] + then + # assume it's a configure.xml file + CONFIGS="$CONFIGS $CONF" + elif [ -d "$CONF" ] + then + # assume it's a directory with configure.xml files + # for example: /etc/jetty.d/ + # sort the files before adding them to the list of CONFIGS + XML_FILES=`ls ${CONF}/*.xml | sort | tr "\n" " "` + for FILE in ${XML_FILES} + do + if [ -r "$FILE" ] && [ -f "$FILE" ] + then + CONFIGS="$CONFIGS $FILE" + else + echo "** WARNING: Cannot read '$FILE' specified in '$JETTY_CONF'" + fi + done + else + echo "** WARNING: Don''t know what to do with '$CONF' specified in '$JETTY_CONF'" + fi + done +fi + +##################################################### +# Run the standard server if there's nothing else to run +##################################################### +if [ -z "$CONFIGS" ] +then + CONFIGS="${JETTY_HOME}/etc/jetty-logging.xml ${JETTY_HOME}/etc/jetty.xml" +fi + + +##################################################### +# Find a location for the pid file +##################################################### +if [ -z "$JETTY_RUN" ] +then + JETTY_RUN=`findDirectory -w /var/run /usr/var/run /tmp` +fi + +##################################################### +# Find a PID for the pid file +##################################################### +if [ -z "$JETTY_PID" ] +then + JETTY_PID="$JETTY_RUN/jetty.pid" +fi + + +################################################## +# Check for JAVA_HOME +################################################## +if [ -z "$JAVA_HOME" ] +then + # If a java runtime is not defined, search the following + # directories for a JVM and sort by version. Use the highest + # version number. + + # Java search path + JAVA_LOCATIONS="\ + /usr/java \ + /usr/bin \ + /usr/local/bin \ + /usr/local/java \ + /usr/local/jdk \ + /usr/local/jre \ + /usr/lib/jvm \ + /opt/java \ + /opt/jdk \ + /opt/jre \ + " + JAVA_NAMES="java jdk jre" + for N in $JAVA_NAMES ; do + for L in $JAVA_LOCATIONS ; do + [ -d $L ] || continue + find $L -name "$N" ! -type d | grep -v threads | while read J ; do + [ -x $J ] || continue + VERSION=`eval $J -version 2>&1` + [ $? = 0 ] || continue + VERSION=`expr "$VERSION" : '.*"\(1.[0-9\.]*\)["_]'` + [ "$VERSION" = "" ] && continue + expr $VERSION \< 1.2 >/dev/null && continue + echo $VERSION:$J + done + done + done | sort | tail -1 > $TMPJ + JAVA=`cat $TMPJ | cut -d: -f2` + JVERSION=`cat $TMPJ | cut -d: -f1` + + JAVA_HOME=`dirname $JAVA` + while [ ! -z "$JAVA_HOME" -a "$JAVA_HOME" != "/" -a ! -f "$JAVA_HOME/lib/tools.jar" ] ; do + JAVA_HOME=`dirname $JAVA_HOME` + done + [ "$JAVA_HOME" = "" ] && JAVA_HOME= + + echo "Found JAVA=$JAVA in JAVA_HOME=$JAVA_HOME" +fi + + +################################################## +# Determine which JVM of version >1.2 +# Try to use JAVA_HOME +################################################## +if [ "$JAVA" = "" -a "$JAVA_HOME" != "" ] +then + if [ ! -z "$JAVACMD" ] + then + JAVA="$JAVACMD" + else + [ -x $JAVA_HOME/bin/jre -a ! -d $JAVA_HOME/bin/jre ] && JAVA=$JAVA_HOME/bin/jre + [ -x $JAVA_HOME/bin/java -a ! -d $JAVA_HOME/bin/java ] && JAVA=$JAVA_HOME/bin/java + fi +fi + +if [ "$JAVA" = "" ] +then + echo "Cannot find a JRE or JDK. Please set JAVA_HOME to a >=1.2 JRE" 2>&2 + exit 1 +fi + +JAVA_VERSION=`expr "$($JAVA -version 2>&1 | head -1)" : '.*1\.\([0-9]\)'` + +##################################################### +# See if JETTY_PORT is defined +##################################################### +if [ "$JETTY_PORT" != "" ] +then + JAVA_OPTIONS="$JAVA_OPTIONS -Djetty.port=$JETTY_PORT" +fi + +##################################################### +# See if JETTY_LOGS is defined +##################################################### +if [ "$JETTY_LOGS" != "" ] +then + JAVA_OPTIONS="$JAVA_OPTIONS -Djetty.logs=$JETTY_LOGS" +fi + +##################################################### +# Are we running on Windows? Could be, with Cygwin/NT. +##################################################### +case "`uname`" in +CYGWIN*) PATH_SEPARATOR=";";; +*) PATH_SEPARATOR=":";; +esac + + +##################################################### +# Add jetty properties to Java VM options. +##################################################### +JAVA_OPTIONS="$JAVA_OPTIONS -Djetty.home=$JETTY_HOME -Djava.io.tmpdir=$TMP" + +[ -f $JETTY_HOME/etc/start.config ] && JAVA_OPTIONS="-DSTART=$JETTY_HOME/etc/start.config $JAVA_OPTIONS" + +##################################################### +# This is how the Jetty server will be started +##################################################### + +JETTY_START=$JETTY_HOME/start.jar +[ ! -f $JETTY_START ] && JETTY_START=$JETTY_HOME/lib/start.jar + +RUN_ARGS="$JAVA_OPTIONS -jar $JETTY_START $JETTY_ARGS $CONFIGS" +RUN_CMD="$JAVA $RUN_ARGS" + +##################################################### +# Comment these out after you're happy with what +# the script is doing. +##################################################### +#echo "JETTY_HOME = $JETTY_HOME" +#echo "JETTY_CONF = $JETTY_CONF" +#echo "JETTY_RUN = $JETTY_RUN" +#echo "JETTY_PID = $JETTY_PID" +#echo "JETTY_ARGS = $JETTY_ARGS" +#echo "CONFIGS = $CONFIGS" +#echo "JAVA_OPTIONS = $JAVA_OPTIONS" +#echo "JAVA = $JAVA" + + +################################################## +# Do the action +################################################## +case "$ACTION" in + start) + echo -n "Starting Jetty: " + + if [ "$NO_START" = "1" ]; then + echo "Not starting jetty - NO_START=1 in /etc/default/jetty7"; + exit 0; + fi + + + if [ "$START_STOP_DAEMON" = "1" ] && type start-stop-daemon > /dev/null 2>&1 + then + [ x$JETTY_USER = x ] && JETTY_USER=$(whoami) + [ $UID = 0 ] && CH_USER="-c $JETTY_USER" + if start-stop-daemon -S -p$JETTY_PID $CH_USER -d $JETTY_HOME -b -m -a $JAVA -- $RUN_ARGS + then + sleep 1 + if running $JETTY_PID + then + echo OK + else + echo FAILED + fi + fi + + else + + if [ -f $JETTY_PID ] + then + if running $JETTY_PID + then + echo "Already Running!!" + exit 1 + else + # dead pid file - remove + rm -f $JETTY_PID + fi + fi + + if [ x$JETTY_USER != x ] + then + touch $JETTY_PID + chown $JETTY_USER $JETTY_PID + su - $JETTY_USER -c " + $RUN_CMD & + PID=\$! + disown \$PID + echo \$PID > $JETTY_PID" + else + $RUN_CMD & + PID=$! + disown $PID + echo $PID > $JETTY_PID + fi + + echo "STARTED Jetty `date`" + fi + + ;; + + stop) + echo -n "Stopping Jetty: " + if [ "$START_STOP_DAEMON" = "1" ] && type start-stop-daemon > /dev/null 2>&1; then + start-stop-daemon -K -p $JETTY_PID -d $JETTY_HOME -a $JAVA -s HUP + sleep 1 + if running $JETTY_PID + then + sleep 3 + if running $JETTY_PID + then + sleep 30 + if running $JETTY_PID + then + start-stop-daemon -K -p $JETTY_PID -d $JETTY_HOME -a $JAVA -s KILL + fi + fi + fi + + rm -f $JETTY_PID + echo OK + else + PID=`cat $JETTY_PID 2>/dev/null` + TIMEOUT=30 + while running $JETTY_PID && [ $TIMEOUT -gt 0 ] + do + kill $PID 2>/dev/null + sleep 1 + let TIMEOUT=$TIMEOUT-1 + done + + [ $TIMEOUT -gt 0 ] || kill -9 $PID 2>/dev/null + + rm -f $JETTY_PID + echo OK + fi + ;; + + restart) + JETTY_SH=$0 + if [ ! -f $JETTY_SH ]; then + if [ ! -f $JETTY_HOME/bin/jetty.sh ]; then + echo "$JETTY_HOME/bin/jetty.sh does not exist." + exit 1 + fi + JETTY_SH=$JETTY_HOME/bin/jetty.sh + fi + $JETTY_SH stop $* + sleep 5 + $JETTY_SH start $* + ;; + + supervise) + # + # Under control of daemontools supervise monitor which + # handles restarts and shutdowns via the svc program. + # + exec $RUN_CMD + ;; + + run|demo) + echo "Running Jetty: " + + if [ -f $JETTY_PID ] + then + if running $JETTY_PID + then + echo "Already Running!!" + exit 1 + else + # dead pid file - remove + rm -f $JETTY_PID + fi + fi + + exec $RUN_CMD + ;; + + check) + echo "Checking arguments to Jetty: " + echo "JETTY_HOME = $JETTY_HOME" + echo "JETTY_CONF = $JETTY_CONF" + echo "JETTY_RUN = $JETTY_RUN" + echo "JETTY_PID = $JETTY_PID" + echo "JETTY_PORT = $JETTY_PORT" + echo "JETTY_LOGS = $JETTY_LOGS" + echo "CONFIGS = $CONFIGS" + echo "JAVA_OPTIONS = $JAVA_OPTIONS" + echo "JAVA = $JAVA" + echo "CLASSPATH = $CLASSPATH" + echo "RUN_CMD = $RUN_CMD" + echo + + if [ -f $JETTY_RUN/jetty.pid ] + then + echo "Jetty running pid="`cat $JETTY_RUN/jetty.pid` + exit 0 + fi + exit 1 + ;; + +*) + usage + ;; +esac + +exit 0 + + + diff --git a/jetty-distribution/src/main/resources/contexts-available/README.TXT b/jetty-distribution/src/main/resources/contexts-available/README.TXT new file mode 100644 index 00000000000..7fa2ac54dae --- /dev/null +++ b/jetty-distribution/src/main/resources/contexts-available/README.TXT @@ -0,0 +1,3 @@ + +This directory contains example contexts that may be deployed by +moving/copying/linking them to the ../contexts directory. diff --git a/jetty-distribution/src/main/resources/contexts/README.TXT b/jetty-distribution/src/main/resources/contexts/README.TXT new file mode 100644 index 00000000000..36f67d70fa6 --- /dev/null +++ b/jetty-distribution/src/main/resources/contexts/README.TXT @@ -0,0 +1,15 @@ + +This directory is scanned by the ContextDeployer instance +configured by the standard $JETTY_HOME/etc/jetty.xml configuration. + +It should contain XmlConfiguration files that describe individual +contexts to be deployed to the server. This directory is scanned +for additions, removals and updates for hot deployment. + +Frequenty the context configuration files here will reference +war files or directories from $JETTY_HOME/webapps. Care must be +taken to avoid a WebAppDeployer deploying duplicates of such +webapplications. + +The directory ../contexts-available contains more example contexts +that may be deployed by being copied here. diff --git a/jetty-distribution/src/main/resources/contexts/javadoc.xml b/jetty-distribution/src/main/resources/contexts/javadoc.xml new file mode 100644 index 00000000000..342e6b99578 --- /dev/null +++ b/jetty-distribution/src/main/resources/contexts/javadoc.xml @@ -0,0 +1,28 @@ + + + + + + + Configure javadoc.xml + /javadoc + /javadoc/ + + + + + index.html + contents.html + + + max-age=3600,public + + + + + diff --git a/jetty-distribution/src/main/resources/javadoc/contents.html b/jetty-distribution/src/main/resources/javadoc/contents.html new file mode 100644 index 00000000000..f1dbfdd9b44 --- /dev/null +++ b/jetty-distribution/src/main/resources/javadoc/contents.html @@ -0,0 +1,7 @@ +

Jetty Javadoc - NOT BUILT!

+ +Please run build the project-website module + + + + diff --git a/jetty-distribution/src/main/resources/resources/log4j.properties b/jetty-distribution/src/main/resources/resources/log4j.properties new file mode 100644 index 00000000000..8899c004be3 --- /dev/null +++ b/jetty-distribution/src/main/resources/resources/log4j.properties @@ -0,0 +1,9 @@ + +# This is not needed by Jetty - but it helps with many web apps. + +log4j.rootLogger=INFO, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n +