Merge branch 'jetty-9.1' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project into jetty-9.1

This commit is contained in:
Jan Bartel 2013-08-29 12:59:50 +10:00
commit c183c6fad5
48 changed files with 462 additions and 894 deletions

View File

@ -461,6 +461,28 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<workingDirectory>${assembly-directory}</workingDirectory>
<arguments>
<argument>-jar</argument>
<argument>start.jar</argument>
<argument>--module-start-ini=server,ext,resources,jsp,annotations</argument>
<argument>--module-ini=http,demo</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>

View File

@ -0,0 +1,53 @@
JETTY
=====
The Jetty project is a 100% Java HTTP Server, HTTP Client
and Servlet Container from the eclipse foundation
http://www.eclipse.org/jetty/
Jetty is open source and is dual licensed using the apache 2.0 and
eclipse public license 1.0. You may choose either license when distributing
jetty.
RUNNING JETTY
=============
The run directory is either the top-level of a binary release
or jetty-distribution/target/assembly-prep directory when built from
source.
To run with the default options:
java -jar start.jar
To see the available options and the default arguments
provided by the start.ini file:
java -jar start.jar --help
Many Jetty features can be enabled by using the --ini command to create
template configurations in the start.d directory. For example:
java -jar start.jar --ini=https
Will enable HTTPS and its dependencies in the files start.d/http.ini and start.d/ssl.ini
To list the know modules:
java -jar start.jar --list-modules
JETTY BASE
==========
If the property jetty.base is defined on the command line, then the jetty start.jar
mechanism will look for start.ini, start.d, webapps and etc files relative to the
jetty.home directory
java -jar start.jar jetty.base=/opt/myjettybase/

View File

@ -1,62 +0,0 @@
JETTY
=====
The Jetty project is a 100% Java HTTP Server, HTTP Client
and Servlet Container from the eclipse foundation
http://www.eclipse.org/jetty/
Jetty is open source and is dual licensed using the apache 2.0 and
eclipse public license 1.0. You may choose either license when distributing
jetty.
BUILDING JETTY
==============
Jetty uses maven 2 as its build system. Maven will fetch
the dependancies, build the server and assemble a runnable
version:
mvn install
RUNNING JETTY
=============
The run directory is either the top-level of a binary release
or jetty-distribution/target/assembly-prep directory when built from
source.
To run with the default options:
java -jar start.jar
To see the available options and the default arguments
provided by the start.ini file:
java -jar start.jar --help
Most start options can be configured in the start.ini file or they can be appended to the start line.
To run with extra configuration file(s) appended, eg SSL
java -jar start.jar etc/jetty-https.xml
To run with properties
java -jar start.jar jetty.port=8081
To run with extra configuration file(s) prepended, eg logging & jmx
java -jar start.jar --pre=etc/jetty-logging.xml --pre=etc/jetty-jmx.xml
To run without the args from start.ini
java -jar start.jar --ini OPTIONS=Server,websocket etc/jetty.xml etc/jetty-deploy.xml etc/jetty-ssl.xml
to list the know OPTIONS:
java -jar start.jar --list-options

View File

@ -0,0 +1,9 @@
DEPEND=server
LIB=jetty-setuid-java-1.0.1.jar
etc/jetty-setuid.xml
INI=# jetty.startServerAsPrivileged=false
INI=# jetty.username=jetty
INI=# jetty.groupname=jetty
INI=# jetty.umask=002

View File

@ -1,26 +1,24 @@
Jetty start.d ini directory
===========================
This start.d directory contains modular ini files that are appended to the effective command line
This start.d directory contains *.ini files that are appended to the effective command line
used to start jetty by the command:
java -jar start.jar
The modules are executed in alphabetic order and the 'NNN-' prefixes are a convention to make that ordering
explicit regardless of module name.
All modules ending with '.ini' will be executed and it is a convention that disabled modules are renamed to
end with '.ini.disabled'. The start.jar mechanism can be used to enable/disable modules with commands like:
java -jar start.jar --enable=ssl --enable=spdy
Note that the numeric prefix can be skipped in such commands.
Each line in these files is prepended to the real command line as arguments, and may be either:
+ A property like: name=value
+ A module to enable like: --module=jmx
+ An XML configuration file like: etc/jetty-feature.xml
+ A start.jar option like: --exec
If --exec or --dry-run are used, then these files may also contain lines with:
+ A JVM option like: -Xmx2000m
+ A System Property like: -Dcom.sun.management.jmxremote
The ini modules have a simple dependency mechanism so a module can declare if it depends on or conflicts with
other modules. For example the spdy module includes the entries:
A template ini file may be created for known modules by using the --ini option.
For example to create an ini templates for https use the command
EXCLUDE=https
DEPEND=npn,ssl
java -jar start.jar --ini=https
This says that spdy cannot be used with the https module (both use the same port and spdy provides https) and
that the npn and ssl modules must also be enabled.

View File

@ -1,12 +0,0 @@
# ===========================================================
# Enable the demonstration web applications
#
# To disable the demos, either delete this file, move it out of
# the start.d directory or rename it to not end with ".ini"
# ===========================================================
--module=demo
demo.realm=demo/realm.properties
jaas.login.conf=demo/login.conf

View File

@ -1,16 +1,16 @@
#===========================================================
# Jetty start.jar arguments
#
# The contents of this file, together with the start.ini
# fragments found in start.d directory are used to build
# The contents of this file, together with the *.ini
# files found in start.d directory are used to build
# the classpath and command line on a call to
# java -jar start.jar [arg...]
#
# Use the following command to see more options
# java -jar start.jar --help
#
# Each line in this file is prepended to the command line
# as arguments, which may be either:
# Each line in these files is prepended to the command line
# as arguments and may be either:
# + A property like: name=value
# + A module to enable like: --module=jmx
# + An XML configuration file like: etc/jetty-feature.xml
@ -21,132 +21,10 @@
# + A JVM option like: -Xmx2000m
# + A System Property like: -Dcom.sun.management.jmxremote
#
#-----------------------------------------------------------
#
# NOTE: The lines in this file may be uncommented to activate
# features. Alternately, the lines may be copied to a ini file
# in the start.d directory to enabled configuration without
# editing this file. See start.d/demo.ini for an example.
# The options --initialize can be used to create a template
# start.d/module.ini file for defined modules. For example
# to create an ini template for https use
# java -jar start.jar --initialize=https
#
#===========================================================
#===========================================================
# Configure JVM arguments.
# If JVM args are include in an ini file then --exec is needed
# to start a new JVM from start.jar with the extra args.
# If you wish to avoid an extra JVM running, place JVM args
# on the normal command line and do not use --exec
#-----------------------------------------------------------
# --exec
# -Xmx2000m
# -Xmn512m
# -XX:+UseConcMarkSweepGC
# -XX:ParallelCMSThreads=2
# -XX:+CMSClassUnloadingEnabled
# -XX:+UseCMSCompactAtFullCollection
# -XX:CMSInitiatingOccupancyFraction=80
# -verbose:gc
# -XX:+PrintGCDateStamps
# -XX:+PrintGCTimeStamps
# -XX:+PrintGCDetails
# -XX:+PrintTenuringDistribution
# -XX:+PrintCommandLineFlags
# -XX:+DisableExplicitGC
# -Dorg.apache.jasper.compiler.disablejsr199=true
#===========================================================
# Default Server Options
# Use the core server jars with websocket on the classpath
# Add the contents of the resources directory to the classpath
# Add jars discovered in lib/ext to the classpath
# Include the core jetty configuration file
#-----------------------------------------------------------
threads.min=10
threads.max=200
threads.timeout=60000
#jetty.host=myhost.com
jetty.dump.start=false
jetty.dump.stop=false
#===========================================================
# JMX Management
# To enable remote JMX access uncomment jmxremote and
# enable --exec
#-----------------------------------------------------------
# jetty.jmxrmihost=localhost
# jetty.jmxrmiport=1099
# -Dcom.sun.management.jmxremote
#===========================================================
# Request logger
# Will add a handler to log all HTTP requests to a standard
# request log format file.
#-----------------------------------------------------------
# requestlog.retain=90
# requestlog.append=true
# requestlog.extended=true
#===========================================================
# stderr/stdout logging.
# The following configuration will redirect stderr and stdout
# to file which is rolled over daily.
#-----------------------------------------------------------
# jetty.log.retain=90
#===========================================================
# Enable SetUID
# The default user and group is 'jetty' and if you are
# starting as root you must change the run privledged to true
#-----------------------------------------------------------
# jetty.startServerAsPrivileged=false
# jetty.username=jetty
# jetty.groupname=jetty
# jetty.umask=002
#===========================================================
# HTTP Connector
#-----------------------------------------------------------
jetty.port=8080
http.timeout=30000
#===========================================================
# SSL Context
# Create the keystore and trust store for use by
# HTTPS and SPDY
#-----------------------------------------------------------
# jetty.keystore=etc/keystore
# jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
# jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g
# jetty.truststore=etc/keystore
# jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
# jetty.secure.port=8443
#===========================================================
# HTTPS Connector
#-----------------------------------------------------------
# jetty.https.port=8443
#===========================================================
# SPDY Connector
#-----------------------------------------------------------
# jetty.spdy.port=8443
# ===========================================================
# JAAS
# -----------------------------------------------------------
# jaas.login.conf=etc/login.conf
#===========================================================
# Low resource managment
#-----------------------------------------------------------
# lowresources.period=1050
# lowresources.lowResourcesIdleTimeout=200
# lowresources.monitorThreads=true
# lowresources.maxConnections=0
# lowresources.maxMemory=0
# lowresources.maxLowResourcesTime=5000

View File

@ -9,3 +9,5 @@ LIB=lib/jetty-jaas-${jetty.version}.jar
# JAAS configuration
etc/jetty-jaas.xml
INI=jaas.login.conf=etc/login.conf

View File

@ -7,3 +7,7 @@ LIB=lib/jetty-jmx-${jetty.version}.jar
# JMX configuration
etc/jetty-jmx.xml
INI=# jetty.jmxrmihost=localhost
INI=# jetty.jmxrmiport=1099
INI=# -Dcom.sun.management.jmxremote

View File

@ -32,8 +32,8 @@
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8080" /></Set>
<Set name="idleTimeout"><Property name="http.timeout" default="30000"/></Set>
<Set name="port"><Property name="jetty.port" default="80" /></Set>
<Set name="idleTimeout"><Property name="http.timeout" default="0"/></Set>
</New>
</Arg>
</Call>

View File

@ -39,8 +39,8 @@
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.https.port" default="8443" /></Set>
<Set name="idleTimeout">30000</Set>
<Set name="port"><Property name="https.port" default="443" /></Set>
<Set name="idleTimeout"><Property name="https.timeout" default="0"/></Set>
</New>
</Arg>
</Call>

View File

@ -15,17 +15,16 @@
<Set name="handler"><Ref refid="oldhandler"/></Set>
<Set name="white">
<Array type="String">
<Item>127.0.0.1</Item>
<Item>127.0.0.2/*.html</Item>
</Array>
<Item>127.0.0.1</Item>
<Item>127.0.0.2/*.html</Item>
</Array>
</Set>
<Set name="black">
<Array type="String">
<Item>127.0.0.1/blacklisted</Item>
<Item>127.0.0.2/black.html</Item>
</Array>
<Item>127.0.0.1/blacklisted</Item>
<Item>127.0.0.2/black.html</Item>
</Array>
</Set>
</New>
</Set>
</Configure>

View File

@ -1,8 +0,0 @@
#
# Base Module
#
OPTIONAL=jmx
LIB=lib/jetty-util-${jetty.version}.jar
LIB=lib/jetty-io-${jetty.version}.jar

View File

@ -0,0 +1,2 @@
LIB=lib/ext/*

View File

@ -1,7 +1,10 @@
#
# Jetty HTTP Server
# Jetty HTTP Connector
#
DEPEND=server
etc/jetty-http.xml
INI=jetty.port=8080
INI=http.timeout=30000

View File

@ -1,8 +1,10 @@
#
# Jetty HTTP Server
# Jetty HTTPS Connector
#
DEPEND=server
DEPEND=ssl
etc/jetty-ssl.xml
etc/jetty-https.xml
INI=https.port=8443
INI=https.timeout=30000

View File

@ -0,0 +1,24 @@
INI=#===========================================================
INI=# Configure JVM arguments.
INI=# If JVM args are include in an ini file then --exec is needed
INI=# to start a new JVM from start.jar with the extra args.
INI=# If you wish to avoid an extra JVM running, place JVM args
INI=# on the normal command line and do not use --exec
INI=#-----------------------------------------------------------
INI=# --exec
INI=# -Xmx2000m
INI=# -Xmn512m
INI=# -XX:+UseConcMarkSweepGC
INI=# -XX:ParallelCMSThreads=2
INI=# -XX:+CMSClassUnloadingEnabled
INI=# -XX:+UseCMSCompactAtFullCollection
INI=# -XX:CMSInitiatingOccupancyFraction=80
INI=# -verbose:gc
INI=# -XX:+PrintGCDateStamps
INI=# -XX:+PrintGCTimeStamps
INI=# -XX:+PrintGCDetails
INI=# -XX:+PrintTenuringDistribution
INI=# -XX:+PrintCommandLineFlags
INI=# -XX:+DisableExplicitGC
INI=# -Dorg.apache.jasper.compiler.disablejsr199=true

View File

@ -5,3 +5,10 @@
DEPEND=server
etc/jetty-lowresources.xml
INI=# lowresources.period=1050
INI=# lowresources.lowResourcesIdleTimeout=200
INI=# lowresources.monitorThreads=true
INI=# lowresources.maxConnections=0
INI=# lowresources.maxMemory=0
INI=# lowresources.maxLowResourcesTime=5000

View File

@ -5,3 +5,7 @@
DEPEND=server
etc/jetty-requestlog.xml
INI=# requestlog.retain=90
INI=# requestlog.append=true
INI=# requestlog.extended=true

View File

@ -0,0 +1,2 @@
LIB=resources

View File

@ -2,14 +2,29 @@
# Base server
#
DEPEND=base
DEPEND=xml
OPTIONAL=jvm
OPTIONAL=jmx
OPTIONAL=ext
OPTIONAL=resources
LIB=lib/servlet-api-3.1.jar
LIB=lib/jetty-schemas-3.1.jar
LIB=lib/jetty-http-${jetty.version}.jar
LIB=lib/jetty-continuation-${jetty.version}.jar
LIB=lib/jetty-server-${jetty.version}.jar
LIB=lib/jetty-xml-${jetty.version}.jar
LIB=lib/jetty-util-${jetty.version}.jar
LIB=lib/jetty-io-${jetty.version}.jar
# Annotations needs annotations configuration
etc/jetty.xml
INI=threads.min=10
INI=threads.max=200
INI=threads.timeout=60000
INI=#jetty.host=myhost.com
INI=jetty.dump.start=false
INI=jetty.dump.stop=false

View File

@ -0,0 +1,13 @@
# SSL Keystore module
DEPEND=server
etc/jetty-ssl.xml
DOWNLOAD=http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore:etc/keystore
INI=jetty.keystore=etc/keystore
INI=jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
INI=jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g
INI=jetty.truststore=etc/keystore
INI=jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
INI=jetty.secure.port=8443

View File

@ -1,8 +0,0 @@
#
# Jetty XML Configuration
#
DEPEND=base
LIB=lib/jetty-xml-${jetty.version}.jar

View File

@ -113,7 +113,7 @@
</Arg>
<!-- Set the initial window size for this SPDY connector. -->
<!-- See: http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3#TOC-2.6.8-WINDOW_UPDATE -->
<Set name="initialWindowSize">65536</Set>
<Set name="initialWindowSize"><Property name="spdy.initialWindowSize" default="65536"/></Set>
<!-- Uncomment to enable ReferrerPushStrategy -->
<!--<Arg name="pushStrategy"><Ref refid="pushStrategy"/></Arg>-->
</New>
@ -128,7 +128,7 @@
</Arg>
<!-- Set the initial window size for this SPDY connector. -->
<!-- See: http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3#TOC-2.6.8-WINDOW_UPDATE -->
<Set name="initialWindowSize">65536</Set>
<Set name="initialWindowSize"><Property name="spdy.initialWindowSize" default="65536"/></Set>
</New>
</Item>
@ -143,13 +143,9 @@
</Array>
</Arg>
<Set name="host">
<Property name="jetty.host"/>
</Set>
<Set name="port">
<Property name="jetty.spdy.port" default="8443"/>
</Set>
<Set name="idleTimeout">30000</Set>
<Set name="host"><Property name="jetty.host"/></Set>
<Set name="port"><Property name="spdy.port" default="443"/></Set>
<Set name="idleTimeout"><Property name="spdy.timeout" default="0"/></Set>
</New>
</Arg>
</Call>

View File

@ -1,4 +1,5 @@
DOWNLOAD=http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
BOOTLIB=-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
INI=-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
INI=--exec

View File

@ -1,8 +1,12 @@
DEPEND=server
DEPEND=ssl
DEPEND=npn
LIB=lib/spdy/*.jar
etc/jetty-ssl.xml
etc/jetty-spdy.xml
INI=spdy.port=8443
INI=spdy.timeout=30000
INI=#spdy.initialWindowSize=65536

View File

@ -21,6 +21,9 @@ package org.eclipse.jetty.start;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -45,9 +48,25 @@ public class BaseHome
public BaseHome()
{
String userDir = System.getProperty("user.dir");
this.homeDir = new File(System.getProperty("jetty.home",userDir));
this.baseDir = new File(System.getProperty("jetty.base",homeDir.getAbsolutePath()));
try
{
this.baseDir = new File(System.getProperty("jetty.base",System.getProperty("user.dir",".")));
URL jarfile=this.getClass().getClassLoader().getResource("org/eclipse/jetty/start/BaseHome.class");
if (jarfile!=null)
{
Matcher m =Pattern.compile("jar:(file:.*)!/org/eclipse/jetty/start/BaseHome.class").matcher(jarfile.toString());
if (m.matches())
homeDir=new File(new URI(m.group(1))).getParentFile();
}
homeDir = new File(System.getProperty("jetty.home",(homeDir==null?baseDir:homeDir).getAbsolutePath()));
baseDir=baseDir.getAbsoluteFile().getCanonicalFile();
homeDir=homeDir.getAbsoluteFile().getCanonicalFile();
}
catch(IOException | URISyntaxException e)
{
throw new RuntimeException(e);
}
}
public BaseHome(File homeDir, File baseDir)

View File

@ -23,11 +23,14 @@ import static org.eclipse.jetty.start.UsageException.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.ConnectException;
@ -41,6 +44,9 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.jetty.start.StartArgs.DownloadArg;
@ -329,12 +335,6 @@ public class Main
modules.dumpEnabledTree();
}
private ModulePersistence loadModulePersistence() throws IOException
{
File file = baseHome.getBaseFile("modules/enabled");
return new ModulePersistence(file);
}
/**
* Convenience for <code>processCommandLine(cmdLine.toArray(new String[cmdLine.size()]))</code>
*/
@ -408,7 +408,6 @@ public class Main
List<String> sources = args.getSources(enabledModule);
modules.enable(enabledModule,sources);
}
modules.enable(loadModulePersistence());
StartLog.debug("Building Module Graph");
modules.buildGraph();
@ -440,12 +439,6 @@ public class Main
usage(true);
}
// Various Downloads
for (DownloadArg url : args.getDownloads())
{
download(url);
}
// Show the version information and return
if (args.isListClasspath())
{
@ -471,23 +464,6 @@ public class Main
System.out.println(cmd.toString());
}
// Enables/Disable
ModulePersistence persistence = loadModulePersistence();
if (args.isModulePersistenceChanging())
{
System.out.println("Persistent Module Management:");
System.out.println("-----------------------------");
System.out.printf("Persistence file: %s%n",baseHome.toShortForm(persistence.getFile()));
for (String module : args.getModulePersistDisable())
{
persistence.disableModule(args,module);
}
for (String module : args.getModulePersistEnable())
{
persistence.enableModule(args,module);
}
}
if (args.isStopCommand())
{
int stopPort = Integer.parseInt(args.getProperties().getProperty("STOP.PORT"));
@ -505,14 +481,17 @@ public class Main
}
}
// Enables/Disable
for (String module : args.getDisable())
// Initialize
for (String module : args.getModuleStartIni())
{
disable(args,module,true);
moduleIni(args,module,true,true);
}
for (String module : args.getEnable())
// Initialize
for (String module : args.getModuleIni())
{
enable(args,module,true);
moduleIni(args,module,true,false);
}
// Informational command line, don't run jetty
@ -635,100 +614,150 @@ public class Main
}
}
private void enable(StartArgs args, String name, boolean verbose) throws IOException
private void moduleIni(StartArgs args, String name, boolean topLevel,boolean appendStartIni) throws IOException
{
File start_d=baseHome.getFile("start.d");
File ini=new File(start_d,name+".ini");
// Is it already enabled
if (ini.exists())
{
if (verbose)
StartLog.warn("Module %s already enabled by: %s",name,baseHome.toShortForm(ini));
return;
}
// Is there a disabled ini?
File disabled=new File(start_d,name+".ini.disabled");
boolean copy=false;
if (!disabled.exists() && baseHome.isBaseDifferent())
{
copy=true;
disabled=new File(new File(baseHome.getHomeDir(),"start.d"),name+".ini.disabled");
if (!disabled.exists())
disabled=new File(new File(baseHome.getHomeDir(),"start.d"),name+".ini");
}
if (disabled.exists())
{
// enable module by renaming/copying ini template
System.err.printf("Enabling %s in %s from %s%n",name,baseHome.toShortForm(ini),baseHome.toShortForm(disabled));
if (copy)
Files.copy(disabled.toPath(),ini.toPath());
else
disabled.renameTo(ini);
args.parse(baseHome, new StartIni(ini));
}
else if (args.getAllModules().resolveEnabled().contains(args.getAllModules().get(name)))
{
// No ini template and module is already enabled
List<String> sources=args.getSources(name);
if (sources!=null && sources.size()>0)
for (String s: args.getSources(name))
StartLog.warn("Module %s is enabled in %s",name,s);
else
StartLog.warn("Module %s is already enabled (see --list-modules)",name);
}
else if (ini.createNewFile())
{
System.err.printf("Enabling %s in %s%n",name,baseHome.toShortForm(ini));
// Create an ini
try(FileOutputStream out = new FileOutputStream(ini);)
{
out.write(("--module="+name+"\n").getBytes("ISO-8859-1"));
}
args.parse(baseHome, new StartIni(ini));
}
else
{
StartLog.warn("ERROR: Module %s cannot be enabled! ",name);
return;
}
// Process dependencies
Modules modules = args.getAllModules();
Module module=modules.get(name);
if (module!=null)
for (String parent:module.getParentNames())
enable(args,parent,false);
}
// Find the start.d relative to the base directory only.
File start_d=baseHome.getBaseFile("start.d");
private void disable(StartArgs args, String name, boolean verbose) throws IOException
{
File start_d=baseHome.getFile("start.d");
File ini=new File(start_d,name+".ini");
// Is this a module?
Modules modules=args.getAllModules();
Module module=modules.get(name);
if (module==null)
{
StartLog.warn("ERROR: No known module for %s",name);
return;
}
// Is it enabled?
// Find any named ini file and check it follows the convention
File start_ini=baseHome.getBaseFile("start.ini");
String short_start_ini = baseHome.toShortForm(start_ini);
File ini=new File(start_d,name+".ini");
String short_ini = baseHome.toShortForm(ini);
StartIni module_ini=null;
if (ini.exists())
{
File disabled=new File(start_d,name+".ini.disabled");
if (disabled.exists())
module_ini=new StartIni(ini);
if (module_ini.getLineMatches(Pattern.compile("--module=(.*, *)*"+name)).size()==0)
{
StartLog.warn("ERROR: Disabled ini already exists: %s",baseHome.toShortForm(disabled));
StartLog.warn("ERROR: %s is not enabled in %s!",name,short_ini);
return;
}
}
boolean transitive=module.isEnabled() && module.getSources().size()==0;
boolean has_ini_lines = module.getInitialise().size()>0;
// If it is not enabled or is transitive with ini template lines or toplevel and doesn't exist
if (!module.isEnabled() || (transitive && has_ini_lines) || (topLevel && !ini.exists() && !appendStartIni))
{
String source=null;
PrintWriter out=null;
try
{
if (appendStartIni)
{
if (!start_ini.exists() && !start_ini.createNewFile() || !start_ini.canWrite())
{
StartLog.warn("ERROR: Bad %s! ",start_ini);
return;
}
source = short_start_ini;
StartLog.warn("%-15s initialised in %s (appended)",name,source);
out = new PrintWriter(new FileWriter(start_ini,true));
}
else
{
// Create the directory if needed
if (!start_d.exists())
start_d.mkdirs();
if (!start_d.isDirectory() || !start_d.canWrite())
{
StartLog.warn("ERROR: Bad start.d %s! ",start_d);
return;
}
// Create a new ini file for it
if (!ini.createNewFile())
{
StartLog.warn("ERROR: %s cannot be initialised in %s! ",name,short_ini);
return;
}
source=short_ini;
StartLog.warn("%-15s initialised in %s (created)",name,source);
out = new PrintWriter(ini);
}
StartLog.warn("Disabling %s from %s",name,baseHome.toShortForm(ini));
ini.renameTo(disabled);
if (appendStartIni)
out.println();
out.println("#");
out.println("# Initialize module "+name);
out.println("#");
Pattern p = Pattern.compile("--module=([^,]+)(,([^,]+))*");
out.println("--module="+name);
args.parse("--module="+name,source);
modules.enable(name,Collections.singletonList(source));
for (String line : module.getInitialise())
{
out.println(line);
args.parse(line,source);
Matcher m=p.matcher(line);
if (m.matches())
{
for (int i=1;i<=m.groupCount();i++)
{
String n=m.group(i);
if (n==null)
continue;
n=n.trim();
if (n.length()==0||n.startsWith(","))
continue;
modules.enable(n,Collections.singletonList(source));
}
}
}
}
finally
{
if (out!=null)
out.close();
}
}
else if (ini.exists())
{
StartLog.info("%-15s initialised in %s",name,short_ini);
}
return;
// Also list other places this module is enabled
for(String source:module.getSources())
{
if (!short_ini.equals(source))
StartLog.warn("%-15s enabled in %s",name,baseHome.toShortForm(source));
}
if (verbose)
StartLog.warn("Module %s, ini file already disabled: %s",name,baseHome.toShortForm(ini));
// Do downloads now
for (String download : module.getDownloads())
download(StartArgs.toDownloadArg(download));
// Process dependencies from top level only
if (topLevel)
{
List<Module> parents = new ArrayList<>();
for (String parent:modules.resolveParentModulesOf(name))
{
if (!name.equals(parent))
{
Module m=modules.get(parent);
m.setEnabled(true);
parents.add(m);
}
}
Collections.sort(parents,Collections.reverseOrder(new Module.DepthComparator()));
for (Module m : parents)
{
moduleIni(args,m.getName(),false,appendStartIni);
}
}
}
public void usage(boolean exit)

View File

@ -73,6 +73,8 @@ public class Module extends TextFile
/** The name of this Module */
private String name;
/** The depth of the module in the tree */
private int depth = 0;
/** List of Modules, by name, that this Module depends on */
private Set<String> parentNames;
/** List of Modules, by name, that this Module optionally depend on */
@ -81,17 +83,14 @@ public class Module extends TextFile
private Set<Module> parentEdges;
/** The Edges to child modules */
private Set<Module> childEdges;
/** The depth of the module in the tree */
private int depth = 0;
/** List of xml configurations for this Module */
private List<String> xmls;
/** List of ini template lines */
private List<String> initialise;
/** List of library options for this Module */
private List<String> libs;
/** List of downloads for this Module */
private List<String> downloads;
/** List of bootlib for this Module */
private List<String> bootlibs;
private List<String> downloads;
/** Is this Module enabled via start.jar command line, start.ini, or start.d/*.ini ? */
@ -197,17 +196,17 @@ public class Module extends TextFile
{
return xmls;
}
public List<String> getInitialise()
{
return initialise;
}
public List<String> getDownloads()
{
return downloads;
}
public List<String> getBootLibs()
{
return bootlibs;
}
@Override
public int hashCode()
{
@ -225,14 +224,14 @@ public class Module extends TextFile
// Strip .ini
this.name = Pattern.compile(".mod$",Pattern.CASE_INSENSITIVE).matcher(name).replaceFirst("");
this.parentNames = new HashSet<>();
this.optionalParentNames = new HashSet<>();
this.parentEdges = new HashSet<>();
this.childEdges = new HashSet<>();
this.xmls = new ArrayList<>();
this.libs = new ArrayList<>();
this.downloads = new ArrayList<>();
this.bootlibs = new ArrayList<>();
parentNames=new HashSet<>();
optionalParentNames=new HashSet<>();
parentEdges=new HashSet<>();
childEdges=new HashSet<>();
xmls=new ArrayList<>();
initialise=new ArrayList<>();
libs=new ArrayList<>();
downloads=new ArrayList<>();
}
public boolean isEnabled()
@ -275,8 +274,8 @@ public class Module extends TextFile
downloads.add(value);
handled = true;
break;
case "BOOTLIB":
bootlibs.add(value);
case "INI":
initialise.add(value);
handled = true;
break;
}

View File

@ -1,182 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.start;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
/**
* Represents the optional, managed by jetty command line, file at ${jetty.base}/modules/enabled
*/
public class ModulePersistence extends TextFile
{
public ModulePersistence(File file) throws FileNotFoundException, IOException
{
super(file);
}
public boolean disableModule(StartArgs args, String moduleName) throws IOException
{
// capture of what modules were disabled by this action
List<String> modulesThatWereDisabled = new ArrayList<>();
// capture of what modules were automatically enabled by this action
// this list can occur if you attempt to disable a leaf node, the parent nodes
// of that leaf would then become enabled
List<String> modulesThatWereEnabled = new ArrayList<>();
// set of child modules that should be disabled by this action
Set<String> resolvedModulesToDisable = args.getAllModules().resolveChildModulesOf(moduleName);
// Show user what could be disabled
System.out.printf(" - Disabling Module: %s%n",moduleName);
if (resolvedModulesToDisable.size() > 1)
{
System.out.printf(" - (Resolved to) : ");
boolean needDelim = false;
for (String name : resolvedModulesToDisable)
{
if (needDelim)
{
System.out.print(" -> ");
}
System.out.print(name);
needDelim = true;
}
System.out.println();
}
// Do the disabling
// Step 1: set parent modules to enabled.
// This is to handle the case where the leaf is disabled, you still
// want the branch itself to be active upto the step before that leaf
Modules modules = args.getAllModules();
Module leaf = modules.get(moduleName);
// no children, this is a leaf
if (leaf.getChildEdges().size() <= 0)
{
// mark all parents as enabled
List<String> sources = new ArrayList<>();
sources.add("<module-persistence>");
for (Module parent : leaf.getParentEdges())
{
parent.setEnabled(true);
parent.addSources(sources);
addUniqueLine(parent.getName());
modulesThatWereEnabled.add(parent.getName());
}
}
// Step 2: mark the leaf nodes disabled
ListIterator<String> iter = super.listIterator();
while (iter.hasNext())
{
String line = iter.next().trim();
if (resolvedModulesToDisable.contains(line))
{
iter.remove();
modulesThatWereDisabled.add(line);
}
}
// Save file
saveFile();
// Show user what was disabled
if (modulesThatWereDisabled.size() > 0)
{
System.out.printf("Disabled %d module%s%n",modulesThatWereDisabled.size(),modulesThatWereDisabled.size() > 1?"s":"");
for (String name : modulesThatWereDisabled)
{
System.out.printf(" - %s%n",name);
}
return true;
}
else if (modulesThatWereEnabled.size() > 0)
{
System.out.printf("Module %s was has been effectively disabled.%n",moduleName);
return true;
}
else
{
System.out.printf("Module %s not found, no changes made to module persistence.%n",moduleName);
return false;
}
}
public boolean enableModule(StartArgs args, String moduleName) throws IOException
{
boolean ret = false;
System.out.printf(" - Enabling Module: %s%n",moduleName);
if (getLines().contains(moduleName))
{
// duplicate
System.out.printf(" - Already present, not adding again%n");
}
else
{
// add it
getLines().add(moduleName);
System.out.printf(" - Adding module %s%n",moduleName);
Set<String> transitiveNames = args.getAllModules().resolveParentModulesOf(moduleName);
if (transitiveNames.size() > 1)
{
System.out.print(" - Enabled: ");
boolean needDelim = false;
for (String name : transitiveNames)
{
if (needDelim)
{
System.out.print(" -> ");
}
System.out.print(name);
needDelim = true;
}
System.out.println();
}
saveFile();
}
return ret;
}
public List<String> getEnabled()
{
return getLines();
}
private void saveFile() throws IOException
{
File file = getFile();
File parent = file.getParentFile();
FS.ensureDirectoryExists(parent);
try (FileWriter writer = new FileWriter(file,false))
{
for (String line : getLines())
{
writer.append(line).append('\n');
}
}
}
}

View File

@ -202,76 +202,6 @@ public class Modules implements Iterable<Module>
}
}
/**
* Enable all modules found in module persistence
*
* @param persistence
* the module persistence to use
*/
public void enable(ModulePersistence persistence)
{
List<String> source = new ArrayList<>();
source.add("<module-persistence>");
if (persistence.getEnabled().size() > 0)
{
// show user warning about module enablement + module persistence
List<String> enabled = new ArrayList<>();
for (Module module : modules.values())
{
if (module.isEnabled())
{
if (!persistence.getEnabled().contains(module.getName()))
{
// only add if not already covered by module persistence
enabled.add(module.getName());
}
}
}
if (enabled.size() > 0)
{
StringBuilder err = new StringBuilder();
err.append("WARNING: Module Persistence Mode is being used.\n");
err.append("The following ");
if (enabled.size() > 1)
{
err.append(enabled.size()).append("modules");
}
else
{
err.append("module");
}
err.append(", defined outside of the module persistence mechanism, ");
if (enabled.size() > 1)
{
err.append("are ");
}
else
{
err.append("is ");
}
err.append("being ignored.");
System.err.println(err);
for (int i = 0; i < enabled.size(); i++)
{
String name = enabled.get(i);
Module module = modules.get(name);
System.err.printf(" [%d] \"%s\" - defined in [%s]%n",i + 1,name,Main.join(module.getSources(),", "));
module.setEnabled(false);
module.clearSources();
}
}
// use module persistence mode
for (String module : persistence.getEnabled())
{
enable(module,source);
}
}
}
public void enable(String name, List<String> sources)
{
Module module = modules.get(name);

View File

@ -146,8 +146,8 @@ public class StartArgs
private Properties properties = new Properties();
private Set<String> systemPropertyKeys = new HashSet<>();
private List<String> jvmArgs = new ArrayList<>();
private List<String> enable = new ArrayList<>();
private List<String> disable = new ArrayList<>();
private List<String> moduleIni = new ArrayList<>();
private List<String> moduleStartIni = new ArrayList<>();
private List<String> modulePersistEnable = new ArrayList<>();
private List<String> modulePersistDisable = new ArrayList<>();
private Modules allModules;
@ -169,7 +169,7 @@ public class StartArgs
classpath = new Classpath();
}
private void addDownload(String uriLocation)
static DownloadArg toDownloadArg(String uriLocation)
{
String parts[] = uriLocation.split(":",3);
if (parts.length != 3)
@ -187,7 +187,12 @@ public class StartArgs
DownloadArg arg = new DownloadArg();
arg.uri = String.format("%s:%s",parts[0],parts[1]);
arg.location = parts[2];
return arg;
}
private void addDownload(String uriLocation)
{
DownloadArg arg=toDownloadArg(uriLocation);
if (!downloads.contains(arg))
{
downloads.add(arg);
@ -429,14 +434,6 @@ public class StartArgs
StartLog.debug("Adding module specified download: %s",download);
addDownload(download);
}
// Register BootLib references
for (String bootlib : module.getBootLibs())
{
StartLog.debug("Adding module specified bootlib: %s",bootlib);
exec = true;
jvmArgs.add(bootlib);
}
}
}
@ -455,14 +452,14 @@ public class StartArgs
return this.commandLine;
}
public List<String> getEnable()
public List<String> getModuleIni()
{
return enable;
return moduleIni;
}
public List<String> getDisable()
public List<String> getModuleStartIni()
{
return disable;
return moduleStartIni;
}
public List<DownloadArg> getDownloads()
@ -690,6 +687,9 @@ public class StartArgs
public void parse(String arg, String source)
{
if (arg.trim().startsWith("#"))
return;
if ("--help".equals(arg) || "-?".equals(arg))
{
if (!CMD_LINE_SOURCE.equals(source))
@ -765,20 +765,20 @@ public class StartArgs
return;
}
if (arg.startsWith("--enable="))
if (arg.startsWith("--module-ini="))
{
if (!CMD_LINE_SOURCE.equals(source))
throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source);
enable.addAll(getValues(arg));
moduleIni.addAll(getValues(arg));
run = false;
return;
}
if (arg.startsWith("--disable="))
if (arg.startsWith("--module-start-ini="))
{
if (!CMD_LINE_SOURCE.equals(source))
throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source);
disable.addAll(getValues(arg));
moduleStartIni.addAll(getValues(arg));
run = false;
return;
}

View File

@ -58,6 +58,11 @@ public class StartLog
return INSTANCE;
}
public static void info(String format, Object... args)
{
System.err.printf(format + "%n",args);
}
public static void warn(String format, Object... args)
{
System.err.printf(format + "%n",args);

View File

@ -67,6 +67,7 @@ public class TextFile implements Iterable<String>
continue;
}
// TODO - bad form calling derived method from base class constructor
process(line.trim());
}
}

View File

@ -57,22 +57,25 @@ Module Management:
o The command line
o The ${jetty.base}/start.ini
o The ${jetty.base}/start.d/*.ini files
o The module persistence file content at
${jetty.base}/modules/enabled
--module=<modulename>
Will temporarily enable a module from the command line.
Note: this can also be used in the ${jetty.base}/start.ini
or ${jetty.base}/start.d/*.ini files.
--enable-module=<modulename>
Will enable a module by adding an entry in the
module persistence file ${jetty.base}/modules/enabled
Note: Do not use within ${jetty.base}/start.ini
--module-ini=<modulename>
Will enable a module by adding an ini file to the
${jetty.base}/start.d/ directory from the template
contained in the module definition. Transitive
dependencies are followed and ini files are created
for them if they too have a ini template.
--disable-module=<modulename>
Will attempt to disable a module by removing an entry in the
module persistence file ${jetty.base}/modules/enabled
Note: Do not use within ${jetty.base}/start.ini
--module-start-ini=<modulename>
Will enable a module by appending lines to the
${jetty.base}/start.ini file from the template
contained in the module definition. Transitive
dependencies are followed and lines are appended
for them if they too have a ini template.
Startup / Shutdown Command Line:
--------------------------------
@ -154,6 +157,6 @@ Properties:
Defaults:
---------
A ${jetty.base}/start.ini file may be used to specify default arguments
to start.jar. In case of a conflict between the command line, and
the contents of ${jetty.base}/start.ini, the command line will win.
A ${jetty.base}/start.ini file and/or ${jetty.base|/start.d/*.ini files may be
used to specify default arguments to start.jar. In case of a conflict between
the command line, and ini files, the command line will win.

View File

@ -115,6 +115,12 @@ public class BaseHomeTest
assertFileList(hb,"Files found",expected,files);
}
@Test
public void testDefault() throws IOException
{
BaseHome bh = new BaseHome();
}
@Test
public void testGetFile_Both() throws IOException

View File

@ -126,25 +126,6 @@ public class ConfigurationAssert
}
assertContainsUnordered("Downloads",expectedDownloads,actualDownloads);
// Validate Jvm Args / BootLib Entries
Set<String> expectedJvmArgs = new HashSet<>();
for (String line : textFile)
{
if (line.startsWith("BOOTLIB|") || line.startsWith("JVM|"))
{
expectedJvmArgs.add(getValue(line));
}
}
Set<String> actualJvmArgs = new HashSet<>();
for (String line : args.getJvmArgs())
{
actualJvmArgs.add(line);
}
assertContainsUnordered("JvmArgs",expectedJvmArgs,actualJvmArgs);
if (expectedJvmArgs.size() > 0)
{
Assert.assertTrue("exec has been turned on",args.isExec());
}
}
private static void assertContainsUnordered(String msg, Set<String> expectedSet, Set<String> actualSet)

View File

@ -1,177 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.start;
import static org.hamcrest.Matchers.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.toolchain.test.FS;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
public class ModulePersistenceTest
{
@Rule
public TestingDir testdir = new TestingDir();
@Test
public void testLoadNoFile() throws IOException
{
File baseDir = testdir.getEmptyDir();
File mfile = new File(baseDir,"modules.p");
ModulePersistence persistence = new ModulePersistence(mfile);
Assert.assertThat("persistence.enabled.size",persistence.getEnabled().size(),is(0));
}
@Test
public void testOneLine() throws IOException
{
File baseDir = testdir.getEmptyDir();
File mfile = new File(baseDir,"modules.p");
writeFile(mfile,"hello");
ModulePersistence persistence = new ModulePersistence(mfile);
Assert.assertThat("persistence.enabled",persistence.getEnabled(),containsInAnyOrder("hello"));
}
@Test
public void testDuplicateLines() throws IOException
{
File baseDir = testdir.getEmptyDir();
File mfile = new File(baseDir,"modules.p");
writeFile(mfile,"hello","there","earthling","hello");
ModulePersistence persistence = new ModulePersistence(mfile);
Assert.assertThat("persistence.enabled",persistence.getEnabled(),containsInAnyOrder("hello","there","earthling"));
}
@Test
public void testDisableHttp() throws Exception
{
File homeDir = MavenTestingUtils.getTestResourceDir("usecases/home");
File baseDir = testdir.getEmptyDir();
File modulesDir = testdir.getFile("modules");
FS.ensureEmpty(modulesDir);
File mfile = new File(modulesDir,"enabled");
writeFile(mfile,"http","websocket");
ModulePersistence persistence = new ModulePersistence(mfile);
Assert.assertThat("persistence.enabled",persistence.getEnabled(),containsInAnyOrder("http","websocket"));
Main main = new Main();
List<String> cmds = new ArrayList<>();
cmds.add("jetty.home=" + homeDir.getAbsolutePath());
cmds.add("jetty.base=" + baseDir.getAbsolutePath());
cmds.add("--disable-module=http");
StartArgs args = main.processCommandLine(cmds);
Assert.assertThat("isRun", args.isRun(), is(false));
main.start(args);
// Load persistence file again
persistence = new ModulePersistence(mfile);
Assert.assertThat("persistence.enabled",persistence.getEnabled(),containsInAnyOrder("server","websocket"));
}
@Test
public void testDisableAnnotations() throws Exception
{
File homeDir = MavenTestingUtils.getTestResourceDir("usecases/home");
File baseDir = testdir.getEmptyDir();
File modulesDir = testdir.getFile("modules");
FS.ensureEmpty(modulesDir);
File mfile = new File(modulesDir,"enabled");
writeFile(mfile,"http","websocket");
ModulePersistence persistence = new ModulePersistence(mfile);
Assert.assertThat("persistence.enabled",persistence.getEnabled(),containsInAnyOrder("http","websocket"));
Main main = new Main();
List<String> cmds = new ArrayList<>();
cmds.add("jetty.home=" + homeDir.getAbsolutePath());
cmds.add("jetty.base=" + baseDir.getAbsolutePath());
cmds.add("--disable-module=annotations");
StartArgs args = main.processCommandLine(cmds);
Assert.assertThat("isRun", args.isRun(), is(false));
main.start(args);
// Load persistence file again
persistence = new ModulePersistence(mfile);
Assert.assertThat("persistence.enabled",persistence.getEnabled(),containsInAnyOrder("http"));
}
@Test
public void testEnableWebSocket() throws Exception
{
File homeDir = MavenTestingUtils.getTestResourceDir("usecases/home");
File baseDir = testdir.getEmptyDir();
File modulesDir = testdir.getFile("modules");
FS.ensureEmpty(modulesDir);
File mfile = new File(modulesDir,"enabled");
writeFile(mfile,"http");
ModulePersistence persistence = new ModulePersistence(mfile);
Assert.assertThat("persistence.enabled",persistence.getEnabled(),containsInAnyOrder("http"));
Main main = new Main();
List<String> cmds = new ArrayList<>();
cmds.add("jetty.home=" + homeDir.getAbsolutePath());
cmds.add("jetty.base=" + baseDir.getAbsolutePath());
cmds.add("--enable-module=websocket");
StartArgs args = main.processCommandLine(cmds);
Assert.assertThat("isRun", args.isRun(), is(false));
main.start(args);
// Load persistence file again
persistence = new ModulePersistence(mfile);
Assert.assertThat("persistence.enabled",persistence.getEnabled(),containsInAnyOrder("http","websocket"));
}
private void writeFile(File mfile, String... lines) throws IOException
{
final String LN = System.getProperty("line.separator");
try (FileWriter writer = new FileWriter(mfile,false))
{
for (String line : lines)
{
writer.append(line).append(LN);
}
}
}
}

View File

@ -68,9 +68,4 @@ public class TestUseCases
assertUseCase("home","base.with.db","assert-with-db.txt");
}
@Test
public void testWithModulePersistence() throws Exception
{
assertUseCase("home","base.with.module.persistence","assert-with-module-persistence.txt");
}
}

View File

@ -1,4 +1,4 @@
DOWNLOAD=http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar
BOOTLIB=-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
INI=-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar

View File

@ -0,0 +1,7 @@
#
# Jetty std err/out logging
#
etc/jetty-logging.xml
INI=# jetty.log.retain=90

View File

@ -14,7 +14,7 @@
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDirName"><Property name="jetty.base" default="." />/demo/webapps</Set>
<Set name="defaultsDescriptor"><Property name="jetty.base" default="." />/etc/webdefault.xml</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="." />/etc/webdefault.xml</Set>
<Set name="scanInterval">1</Set>
<Set name="extractWars">true</Set>
<Set name="configurationManager">

View File

@ -2,8 +2,8 @@
# Jetty Demo Module
#
DEPEND=jndi
DEPEND=jaas
DEPEND=jndi
DEPEND=rewrite
DEPEND=client
DEPEND=annotations
@ -14,3 +14,7 @@ LIB=demo/lib/*.jar
demo/test-realm.xml
demo/jetty-demo.xml
INI=--module=jaas
INI=demo.realm=demo/realm.properties
INI=jaas.login.conf=demo/login.conf