首页 > 代码库 > jetty在Linux下的配置
jetty在Linux下的配置
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- =============================================================== -->
<!-- Create the deployment manager -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- The deplyment manager handles the lifecycle of deploying web -->
<!-- applications. Apps are provided by instances of the -->
<!-- AppProvider interface. -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addBean">
<Arg>
<New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
<Set name="contexts">
<Ref refid="Contexts" />
</Set>
<Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/servlet-api-[^/]*\.jar$</Arg>
</Call>
<!-- Add a customize step to the deployment lifecycle -->
<!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class
<Call name="insertLifeCycleNode">
<Arg>deployed</Arg>
<Arg>starting</Arg>
<Arg>customise</Arg>
</Call>
<Call name="addLifeCycleBinding">
<Arg>
<New class="org.eclipse.jetty.deploy.bindings.DebugBinding">
<Arg>customise</Arg>
</New>
</Arg>
</Call> -->
<Call id="webappprovider" name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDirName"><Property name="jetty.webapps"/></Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="." />/etc/webdefault.xml</Set>
<Set name="scanInterval">0</Set>
<Set name="extractWars">true</Set>
<Set name="configurationManager">
<New class="org.eclipse.jetty.deploy.PropertiesConfigurationManager"></New>
</Set>
</New>
</Arg>
</Call>
</New>
</Arg>
</Call>
</Configure>
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- =============================================================== -->
<!-- Mixin the Start FileNoticeLifeCycleListener -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addLifeCycleListener">
<Arg>
<New class="org.eclipse.jetty.util.component.FileNoticeLifeCycleListener">
<Arg><Property name="jetty.state"/></Arg>
</New>
</Arg>
</Call>
</Configure>
#!/usr/bin/env bash
#Author Simon
# set profile
source ~/.bash_profile
# set project directory
if [ -z "$PROJECT_HOME" ]
then
START_SH=$0
case "$START_SH" in
/*) PROJECT_HOME=${START_SH%/*} ;;
./*/*/*) PROJECT_HOME=${START_SH%/*} ;;
./*) PROJECT_HOME=. ;;
esac
fi
cd "$PROJECT_HOME"
PROJECT_HOME=$PWD
# set jetty home directory
JETTY_HOME=${PROJECT_HOME%/*/*}
cd "$JETTY_HOME"
# create project log directory
logDir="$PROJECT_HOME/log"
if [ ! -d ${logDir} ]
then
$(mkdir -p ${logDir})
fi
# create project data directory
dataDir="$PROJECT_HOME/data"
if [ ! -d ${dataDir} ]
then
$(mkdir -p ${dataDir})
fi
source "$PROJECT_HOME/server.conf"
# jetty status
if [ -z "$JETTY_STATE" ]
then
JETTY_STATE=$dataDir/jetty.state
fi
rm -f $JETTY_STATE
if [ -z "$JAVA" ]
then
JAVA=$(which java)
fi
# Add jetty properties to Java VM options.
TMPDIR=${TMPDIR:-/tmp}
JAVA_OPTIONS+=("-Djetty.home=$JETTY_HOME" "-Djava.io.tmpdir=$TMPDIR")
# 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
START_INI=$(dirname $JETTY_START)/start.ini
[ -r "$START_INI" ] || START_INI=""
CONFIGS=(
${JETTY_HOME}/etc/jetty-logging.xml
${PROJECT_HOME}/etc/jetty-deploy.xml
${PROJECT_HOME}/etc/jetty-started.xml
)
JETTY_ARGS=(
"jetty.logs"=${PROJECT_HOME}/log
"jetty.webapps"=${PROJECT_HOME}/webapps