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:
Greg Wilkins 2013-08-30 14:38:41 +10:00
commit 5fce6408d0
106 changed files with 882 additions and 757 deletions

View File

@ -2,13 +2,16 @@
# Jetty Annotation Scanning Module # Jetty Annotation Scanning Module
# #
[depend]
# Annotations needs plus, and jndi features # Annotations needs plus, and jndi features
DEPEND=plus plus
[lib]
# Annotations needs jetty annotation jars # Annotations needs jetty annotation jars
LIB=lib/jetty-annotations-${jetty.version}.jar lib/jetty-annotations-${jetty.version}.jar
# Need annotation processing jars too # Need annotation processing jars too
LIB=lib/annotations/*.jar lib/annotations/*.jar
[xml]
# Enable annotation scanning webapp configurations # Enable annotation scanning webapp configurations
etc/jetty-annotations.xml etc/jetty-annotations.xml

View File

@ -2,5 +2,6 @@
# Client Feature # Client Feature
# #
[lib]
# Client jars # Client jars
LIB=lib/jetty-client-${jetty.version}.jar lib/jetty-client-${jetty.version}.jar

View File

@ -2,10 +2,13 @@
# Deploy Feature # Deploy Feature
# #
DEPEND=webapp [depend]
webapp
[lib]
# Deploy jars # Deploy jars
LIB=lib/jetty-deploy-${jetty.version}.jar lib/jetty-deploy-${jetty.version}.jar
[xml]
# Deploy configuration # Deploy configuration
etc/jetty-deploy.xml etc/jetty-deploy.xml

View File

@ -10,7 +10,7 @@
<url>http://www.eclipse.org/jetty</url> <url>http://www.eclipse.org/jetty</url>
<packaging>pom</packaging> <packaging>pom</packaging>
<properties> <properties>
<assembly-directory>target/distribution</assembly-directory> <assembly-directory>${basedir}/target/distribution</assembly-directory>
<jetty-setuid-version>1.0.1</jetty-setuid-version> <jetty-setuid-version>1.0.1</jetty-setuid-version>
</properties> </properties>
<build> <build>
@ -101,7 +101,7 @@
<type>war</type> <type>war</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>
<includes>**</includes> <includes>**</includes>
<outputDirectory>${assembly-directory}/demo/webapps</outputDirectory> <outputDirectory>${assembly-directory}/demo-base/webapps</outputDirectory>
<destFileName>test.war</destFileName> <destFileName>test.war</destFileName>
</artifactItem> </artifactItem>
<artifactItem> <artifactItem>
@ -111,7 +111,7 @@
<type>war</type> <type>war</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>
<includes>**</includes> <includes>**</includes>
<outputDirectory>${assembly-directory}/demo/webapps</outputDirectory> <outputDirectory>${assembly-directory}/demo-base/webapps</outputDirectory>
<destFileName>test-jaas.war</destFileName> <destFileName>test-jaas.war</destFileName>
</artifactItem> </artifactItem>
<artifactItem> <artifactItem>
@ -121,7 +121,7 @@
<type>war</type> <type>war</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>
<includes>**</includes> <includes>**</includes>
<outputDirectory>${assembly-directory}/demo/webapps</outputDirectory> <outputDirectory>${assembly-directory}/demo-base/webapps</outputDirectory>
<destFileName>test-jndi.war</destFileName> <destFileName>test-jndi.war</destFileName>
</artifactItem> </artifactItem>
<artifactItem> <artifactItem>
@ -131,7 +131,7 @@
<type>war</type> <type>war</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>
<includes>**</includes> <includes>**</includes>
<outputDirectory>${assembly-directory}/demo/webapps</outputDirectory> <outputDirectory>${assembly-directory}/demo-base/webapps</outputDirectory>
<destFileName>test-spec.war</destFileName> <destFileName>test-spec.war</destFileName>
</artifactItem> </artifactItem>
<artifactItem> <artifactItem>
@ -141,7 +141,7 @@
<type>war</type> <type>war</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>
<includes>**</includes> <includes>**</includes>
<outputDirectory>${assembly-directory}/demo/webapps</outputDirectory> <outputDirectory>${assembly-directory}/demo-base/webapps</outputDirectory>
<destFileName>xref-proxy.war</destFileName> <destFileName>xref-proxy.war</destFileName>
</artifactItem> </artifactItem>
<artifactItem> <artifactItem>
@ -151,7 +151,7 @@
<type>war</type> <type>war</type>
<overWrite>true</overWrite> <overWrite>true</overWrite>
<includes>**</includes> <includes>**</includes>
<outputDirectory>${assembly-directory}/demo/webapps</outputDirectory> <outputDirectory>${assembly-directory}/demo-base/webapps</outputDirectory>
<destFileName>async-rest.war</destFileName> <destFileName>async-rest.war</destFileName>
</artifactItem> </artifactItem>
<artifactItem> <artifactItem>
@ -466,20 +466,19 @@
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>process-classes</phase>
<goals> <goals>
<goal>exec</goal> <goal>java</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<executable>java</executable> <mainClass>org.eclipse.jetty.start.Main</mainClass>
<workingDirectory>${assembly-directory}</workingDirectory>
<arguments> <arguments>
<argument>-jar</argument> <argument>--debug</argument>
<argument>start.jar</argument> <argument>jetty.home=${assembly-directory}</argument>
<argument>--module-start-ini=server,ext,resources,jsp,annotations</argument> <argument>jetty.base=${assembly-directory}</argument>
<argument>--module-ini=http,demo</argument> <argument>--module-start-ini=server,deploy,http,websocket,jsp,ext,resources</argument>
</arguments> </arguments>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -1,9 +1,14 @@
DEPEND=server [depend]
LIB=jetty-setuid-java-1.0.1.jar server
[lib]
jetty-setuid-java-1.0.1.jar
[xml]
etc/jetty-setuid.xml etc/jetty-setuid.xml
INI=# jetty.startServerAsPrivileged=false [ini]
INI=# jetty.username=jetty # jetty.startServerAsPrivileged=false
INI=# jetty.groupname=jetty # jetty.username=jetty
INI=# jetty.umask=002 # jetty.groupname=jetty
# jetty.umask=002

View File

@ -362,25 +362,11 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
*/ */
public void submit(Runnable change) public void submit(Runnable change)
{ {
if (isSelectorThread()) // This method may be called from the selector thread, and therefore
{ // we could directly run the change without queueing, but this may
if (_state.get() == State.PROCESS) // lead to stack overflows on a busy server, so we always offer the
{ // change to the queue and process the state.
// We are processing, so lets handle existing changes
runChanges();
// and then directly run the passed change without queueing it
runChange(change);
}
else
{
// We must be iterating in CHANGES or MORE_CHANGES
// state, so just append to the queue to preserve order.
_changes.offer(change);
}
}
else
{
// Otherwise we have to queue the change and possibly wakeup the selector
_changes.offer(change); _changes.offer(change);
LOG.debug("Queued change {}", change); LOG.debug("Queued change {}", change);
@ -414,7 +400,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
} }
} }
} }
}
private void runChanges() private void runChanges()
{ {

View File

@ -2,12 +2,16 @@
# JAAS Feature # JAAS Feature
# #
DEPEND=server [depend]
server
[lib]
# JAAS jars # JAAS jars
LIB=lib/jetty-jaas-${jetty.version}.jar lib/jetty-jaas-${jetty.version}.jar
[xml]
# JAAS configuration # JAAS configuration
etc/jetty-jaas.xml etc/jetty-jaas.xml
INI=jaas.login.conf=etc/login.conf [ini]
jaas.login.conf=etc/login.conf

View File

@ -2,12 +2,15 @@
# JMX Feature # JMX Feature
# #
[lib]
# JMX jars (as defined in start.config) # JMX jars (as defined in start.config)
LIB=lib/jetty-jmx-${jetty.version}.jar lib/jetty-jmx-${jetty.version}.jar
[xml]
# JMX configuration # JMX configuration
etc/jetty-jmx.xml etc/jetty-jmx.xml
INI=# jetty.jmxrmihost=localhost [ini]
INI=# jetty.jmxrmiport=1099 # jetty.jmxrmihost=localhost
INI=# -Dcom.sun.management.jmxremote # jetty.jmxrmiport=1099
# -Dcom.sun.management.jmxremote

View File

@ -2,8 +2,10 @@
# JNDI Support # JNDI Support
# #
DEPEND=server [depend]
server
LIB=lib/jetty-jndi-${jetty.version}.jar [lib]
LIB=lib/jndi/*.jar lib/jetty-jndi-${jetty.version}.jar
lib/jndi/*.jar

View File

@ -2,7 +2,9 @@
# Jetty Servlet Module # Jetty Servlet Module
# #
DEPEND=servlet [depend]
servlet
LIB=lib/jsp/*.jar [lib]
lib/jsp/*.jar

View File

@ -2,9 +2,12 @@
# Jetty Monitor module # Jetty Monitor module
# #
DEPEND=server [depend]
DEPEND=client server
client
LIB=lib/jetty-monitor-${jetty.version}.jar [lib]
lib/jetty-monitor-${jetty.version}.jar
[xml]
etc/jetty-monitor.xml etc/jetty-monitor.xml

View File

@ -2,6 +2,8 @@
# Jetty Nosql module # Jetty Nosql module
# #
DEPEND=webapp [depend]
webapp
LIB=lib/jetty-nosql-${jetty.version}.jar [lib]
lib/jetty-nosql-${jetty.version}.jar

View File

@ -2,9 +2,12 @@
# Jetty Overlay module # Jetty Overlay module
# #
DEPEND=deploy [depend]
deploy
LIB=lib/jetty-overlay-deployer-${jetty.version}.jar [lib]
lib/jetty-overlay-deployer-${jetty.version}.jar
[xml]
# Plus requires configuration # Plus requires configuration
etc/jetty-overlay.xml etc/jetty-overlay.xml

View File

@ -2,11 +2,14 @@
# Jetty Proxy module # Jetty Proxy module
# #
DEPEND=server [depend]
DEPEND=security server
DEPEND=jndi security
jndi
LIB=lib/jetty-plus-${jetty.version}.jar [lib]
lib/jetty-plus-${jetty.version}.jar
[xml]
# Plus requires configuration # Plus requires configuration
etc/jetty-plus.xml etc/jetty-plus.xml

View File

@ -2,10 +2,13 @@
# Jetty Proxy module # Jetty Proxy module
# #
DEPEND=server [depend]
DEPEND=client server
client
LIB=lib/jetty-proxy-${jetty.version}.jar [lib]
lib/jetty-proxy-${jetty.version}.jar
[xml]
# Proxy requires configuration # Proxy requires configuration
etc/jetty-proxy.xml etc/jetty-proxy.xml

View File

@ -2,9 +2,12 @@
# Jetty Rewrite module # Jetty Rewrite module
# #
DEPEND=server [depend]
server
LIB=lib/jetty-rewrite-${jetty.version}.jar [lib]
lib/jetty-rewrite-${jetty.version}.jar
[xml]
# Annotations needs annotations configuration # Annotations needs annotations configuration
etc/jetty-rewrite.xml etc/jetty-rewrite.xml

View File

@ -2,6 +2,8 @@
# Jetty Security Module # Jetty Security Module
# #
DEPEND=server [depend]
server
LIB=lib/jetty-security-${jetty.version}.jar [lib]
lib/jetty-security-${jetty.version}.jar

View File

@ -2,6 +2,8 @@
# Debug module # Debug module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-debug.xml etc/jetty-debug.xml

View File

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

View File

@ -2,9 +2,12 @@
# Jetty HTTP Connector # Jetty HTTP Connector
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-http.xml etc/jetty-http.xml
INI=jetty.port=8080 [ini]
INI=http.timeout=30000 jetty.port=8080
http.timeout=30000

View File

@ -2,9 +2,12 @@
# Jetty HTTPS Connector # Jetty HTTPS Connector
# #
DEPEND=ssl [depend]
ssl
[xml]
etc/jetty-https.xml etc/jetty-https.xml
INI=https.port=8443 [ini]
INI=https.timeout=30000 https.port=8443
https.timeout=30000

View File

@ -2,6 +2,8 @@
# IPAccess module # IPAccess module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-ipaccess.xml etc/jetty-ipaccess.xml

View File

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

View File

@ -2,13 +2,16 @@
# Low Resources module # Low Resources module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-lowresources.xml etc/jetty-lowresources.xml
INI=# lowresources.period=1050 [ini]
INI=# lowresources.lowResourcesIdleTimeout=200 # lowresources.period=1050
INI=# lowresources.monitorThreads=true # lowresources.lowResourcesIdleTimeout=200
INI=# lowresources.maxConnections=0 # lowresources.monitorThreads=true
INI=# lowresources.maxMemory=0 # lowresources.maxConnections=0
INI=# lowresources.maxLowResourcesTime=5000 # lowresources.maxMemory=0
# lowresources.maxLowResourcesTime=5000

View File

@ -2,10 +2,13 @@
# Request Log module # Request Log module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-requestlog.xml etc/jetty-requestlog.xml
INI=# requestlog.retain=90 [ini]
INI=# requestlog.append=true # requestlog.retain=90
INI=# requestlog.extended=true # requestlog.append=true
# requestlog.extended=true

View File

@ -1,2 +1,2 @@
[lib]
LIB=resources resources

View File

@ -2,29 +2,32 @@
# Base server # Base server
# #
OPTIONAL=jvm [optional]
OPTIONAL=jmx jvm
OPTIONAL=ext jmx
OPTIONAL=resources ext
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
[lib]
lib/servlet-api-3.1.jar
lib/jetty-schemas-3.1.jar
lib/jetty-http-${jetty.version}.jar
lib/jetty-continuation-${jetty.version}.jar
lib/jetty-server-${jetty.version}.jar
lib/jetty-xml-${jetty.version}.jar
lib/jetty-util-${jetty.version}.jar
lib/jetty-io-${jetty.version}.jar
[xml]
# Annotations needs annotations configuration # Annotations needs annotations configuration
etc/jetty.xml etc/jetty.xml
INI=threads.min=10 [ini]
INI=threads.max=200 threads.min=10
INI=threads.timeout=60000 threads.max=200
INI=#jetty.host=myhost.com threads.timeout=60000
INI=jetty.dump.start=false #jetty.host=myhost.com
INI=jetty.dump.stop=false jetty.dump.start=false
jetty.dump.stop=false

View File

@ -1,13 +1,19 @@
# SSL Keystore module # SSL Keystore module
DEPEND=server [depend]
etc/jetty-ssl.xml server
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 [xml]
INI=jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 etc/jetty-ssl.xml
INI=jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g
INI=jetty.truststore=etc/keystore [download]
INI=jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore:etc/keystore
INI=jetty.secure.port=8443
[ini]
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

View File

@ -2,6 +2,8 @@
# Stats module # Stats module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-stats.xml etc/jetty-stats.xml

View File

@ -2,6 +2,8 @@
# Stats module # Stats module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-xinetd.xml etc/jetty-xinetd.xml

View File

@ -2,6 +2,8 @@
# Jetty Servlet Module # Jetty Servlet Module
# #
DEPEND=server [depend]
server
LIB=lib/jetty-servlet-${jetty.version}.jar [lib]
lib/jetty-servlet-${jetty.version}.jar

View File

@ -2,6 +2,8 @@
# Jetty Servlets Module # Jetty Servlets Module
# #
DEPEND=servlet [depend]
servlet
LIB=lib/jetty-servlets-${jetty.version}.jar [lib]
lib/jetty-servlets-${jetty.version}.jar

View File

@ -1,5 +1,7 @@
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 [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
INI=-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar [ini]
INI=--exec -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar
--exec

View File

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

View File

@ -51,19 +51,21 @@ public class BaseHome
try try
{ {
this.baseDir = new File(System.getProperty("jetty.base",System.getProperty("user.dir","."))); this.baseDir = new File(System.getProperty("jetty.base",System.getProperty("user.dir",".")));
URL jarfile=this.getClass().getClassLoader().getResource("org/eclipse/jetty/start/BaseHome.class"); URL jarfile = this.getClass().getClassLoader().getResource("org/eclipse/jetty/start/BaseHome.class");
if (jarfile!=null) if (jarfile != null)
{ {
Matcher m =Pattern.compile("jar:(file:.*)!/org/eclipse/jetty/start/BaseHome.class").matcher(jarfile.toString()); Matcher m = Pattern.compile("jar:(file:.*)!/org/eclipse/jetty/start/BaseHome.class").matcher(jarfile.toString());
if (m.matches()) if (m.matches())
homeDir=new File(new URI(m.group(1))).getParentFile(); {
homeDir = new File(new URI(m.group(1))).getParentFile();
} }
homeDir = new File(System.getProperty("jetty.home",(homeDir==null?baseDir:homeDir).getAbsolutePath())); }
homeDir = new File(System.getProperty("jetty.home",(homeDir == null?baseDir:homeDir).getAbsolutePath()));
baseDir=baseDir.getAbsoluteFile().getCanonicalFile(); baseDir = baseDir.getAbsoluteFile().getCanonicalFile();
homeDir=homeDir.getAbsoluteFile().getCanonicalFile(); homeDir = homeDir.getAbsoluteFile().getCanonicalFile();
} }
catch(IOException | URISyntaxException e) catch (IOException | URISyntaxException e)
{ {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -71,8 +73,15 @@ public class BaseHome
public BaseHome(File homeDir, File baseDir) public BaseHome(File homeDir, File baseDir)
{ {
this.homeDir = homeDir; try
this.baseDir = baseDir == null?homeDir:baseDir; {
this.homeDir = homeDir.getCanonicalFile();
this.baseDir = baseDir == null?this.homeDir:baseDir.getCanonicalFile();
}
catch (IOException e)
{
throw new RuntimeException(e);
}
} }
public String getBase() public String getBase()

View File

@ -0,0 +1,107 @@
//
// ========================================================================
// 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;
public class DownloadArg
{
public String uri;
public String location;
public DownloadArg(String uriLocation)
{
String parts[] = uriLocation.split(":",3);
if (parts.length != 3)
{
throw new IllegalArgumentException("Not <http uri>:<location>");
}
if (!"http".equalsIgnoreCase(parts[0]))
{
throw new IllegalArgumentException("Download only supports http protocol");
}
if (!parts[1].startsWith("//"))
{
throw new IllegalArgumentException("Download URI invalid: " + uriLocation);
}
this.uri = String.format("%s:%s",parts[0],parts[1]);
this.location = parts[2];
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
DownloadArg other = (DownloadArg)obj;
if (uri == null)
{
if (other.uri != null)
{
return false;
}
}
else if (!uri.equals(other.uri))
{
return false;
}
if (location == null)
{
if (other.location != null)
{
return false;
}
}
else if (!location.equals(other.location))
{
return false;
}
return true;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = (prime * result) + ((uri == null)?0:uri.hashCode());
result = (prime * result) + ((location == null)?0:location.hashCode());
return result;
}
@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("DownloadArg [uri=");
builder.append(uri);
builder.append(", location=");
builder.append(location);
builder.append("]");
return builder.toString();
}
}

View File

@ -29,7 +29,6 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.LineNumberReader; import java.io.LineNumberReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -38,18 +37,14 @@ import java.net.InetAddress;
import java.net.Socket; import java.net.Socket;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.net.URL; import java.net.URL;
import java.nio.file.Files;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.eclipse.jetty.start.StartArgs.DownloadArg;
/** /**
* Main start class. * Main start class.
* <p> * <p>
@ -233,7 +228,7 @@ public class Main
System.out.println("Version Information on " + classpath.count() + " entr" + ((classpath.count() > 1)?"ies":"y") + " in the classpath."); System.out.println("Version Information on " + classpath.count() + " entr" + ((classpath.count() > 1)?"ies":"y") + " in the classpath.");
System.out.println("Note: order presented here is how they would appear on the classpath."); System.out.println("Note: order presented here is how they would appear on the classpath.");
System.out.println(" changes to the MODULES=[name,name,...] command line option will be reflected here."); System.out.println(" changes to the --module=name command line options will be reflected here.");
int i = 0; int i = 0;
for (File element : classpath.getElements()) for (File element : classpath.getElements())
@ -335,6 +330,166 @@ public class Main
modules.dumpEnabledTree(); modules.dumpEnabledTree();
} }
private void moduleIni(StartArgs args, String name, boolean topLevel, boolean appendStartIni) throws IOException
{
// Find the start.d relative to the base directory only.
File start_d = baseHome.getBaseFile("start.d");
// 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;
}
// 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())
{
module_ini = new StartIni(ini);
if (module_ini.getLineMatches(Pattern.compile("--module=(.*, *)*" + name)).size() == 0)
{
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);
}
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);
}
// 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));
}
}
// Do downloads now
for (String download : module.getDownloads())
{
download(new DownloadArg(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);
}
}
}
/** /**
* Convenience for <code>processCommandLine(cmdLine.toArray(new String[cmdLine.size()]))</code> * Convenience for <code>processCommandLine(cmdLine.toArray(new String[cmdLine.size()]))</code>
*/ */
@ -481,7 +636,6 @@ public class Main
} }
} }
// Initialize // Initialize
for (String module : args.getModuleStartIni()) for (String module : args.getModuleStartIni())
{ {
@ -614,152 +768,6 @@ public class Main
} }
} }
private void moduleIni(StartArgs args, String name, boolean topLevel,boolean appendStartIni) throws IOException
{
// Find the start.d relative to the base directory only.
File start_d=baseHome.getBaseFile("start.d");
// 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;
}
// 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())
{
module_ini=new StartIni(ini);
if (module_ini.getLineMatches(Pattern.compile("--module=(.*, *)*"+name)).size()==0)
{
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);
}
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);
}
// 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));
}
// 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) public void usage(boolean exit)
{ {
String usageResource = "org/eclipse/jetty/start/usage.txt"; String usageResource = "org/eclipse/jetty/start/usage.txt";

View File

@ -18,8 +18,10 @@
package org.eclipse.jetty.start; package org.eclipse.jetty.start;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.text.CollationKey; import java.text.CollationKey;
import java.text.Collator; import java.text.Collator;
@ -30,12 +32,15 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.omg.CORBA.INITIALIZE;
/** /**
* Represents a Module metadata, as defined in Jetty. * Represents a Module metadata, as defined in Jetty.
*/ */
public class Module extends TextFile public class Module // extends TextFile
{ {
public static class NameComparator implements Comparator<Module> public static class NameComparator implements Comparator<Module>
{ {
@ -71,6 +76,8 @@ public class Module extends TextFile
} }
} }
/** The file of the module */
private File file;
/** The name of this Module */ /** The name of this Module */
private String name; private String name;
/** The depth of the module in the tree */ /** The depth of the module in the tree */
@ -92,7 +99,6 @@ public class Module extends TextFile
/** List of downloads for this Module */ /** List of downloads for this Module */
private List<String> downloads; private List<String> downloads;
/** Is this Module enabled via start.jar command line, start.ini, or start.d/*.ini ? */ /** Is this Module enabled via start.jar command line, start.ini, or start.d/*.ini ? */
private boolean enabled = false; private boolean enabled = false;
/** List of sources that enabled this module */ /** List of sources that enabled this module */
@ -100,11 +106,14 @@ public class Module extends TextFile
public Module(File file) throws FileNotFoundException, IOException public Module(File file) throws FileNotFoundException, IOException
{ {
super(file); this.file = file;
String name = file.getName(); String name = file.getName();
// Strip .ini // Strip .ini
name = Pattern.compile(".mod$",Pattern.CASE_INSENSITIVE).matcher(name).replaceFirst(""); name = Pattern.compile(".mod$",Pattern.CASE_INSENSITIVE).matcher(name).replaceFirst("");
init();
process();
} }
public void addChildEdge(Module child) public void addChildEdge(Module child)
@ -216,22 +225,21 @@ public class Module extends TextFile
return result; return result;
} }
@Override
public void init() public void init()
{ {
String name = getFile().getName(); String name = file.getName();
// Strip .ini // Strip .ini
this.name = Pattern.compile(".mod$",Pattern.CASE_INSENSITIVE).matcher(name).replaceFirst(""); this.name = Pattern.compile(".mod$",Pattern.CASE_INSENSITIVE).matcher(name).replaceFirst("");
parentNames=new HashSet<>(); parentNames = new HashSet<>();
optionalParentNames=new HashSet<>(); optionalParentNames = new HashSet<>();
parentEdges=new HashSet<>(); parentEdges = new HashSet<>();
childEdges=new HashSet<>(); childEdges = new HashSet<>();
xmls=new ArrayList<>(); xmls = new ArrayList<>();
initialise=new ArrayList<>(); initialise = new ArrayList<>();
libs=new ArrayList<>(); libs = new ArrayList<>();
downloads=new ArrayList<>(); downloads = new ArrayList<>();
} }
public boolean isEnabled() public boolean isEnabled()
@ -239,61 +247,69 @@ public class Module extends TextFile
return enabled; return enabled;
} }
@Override public void process() throws FileNotFoundException, IOException
public void process(String line)
{ {
boolean handled = false; Pattern section = Pattern.compile("\\s*\\[([^]]*)\\]\\s*");
if (line == null) if (!FS.canReadFile(file))
{ {
StartLog.debug("Skipping read of missing file: %s",file.getAbsolutePath());
}
// has assignment
int idx = line.indexOf('=');
if (idx >= 0)
{
String key = line.substring(0,idx);
String value = line.substring(idx + 1);
switch (key.toUpperCase(Locale.ENGLISH))
{
case "DEPEND":
parentNames.add(value);
handled = true;
break;
case "LIB":
libs.add(value);
handled = true;
break;
case "OPTIONAL":
optionalParentNames.add(value);
handled = true;
break;
case "DOWNLOAD":
downloads.add(value);
handled = true;
break;
case "INI":
initialise.add(value);
handled = true;
break;
}
}
if (handled)
{
return; // no further processing of line needed
}
// Is it an XML line?
if (FS.isXml(line))
{
xmls.add(line);
return; return;
} }
throw new IllegalArgumentException("Unrecognized Module Metadata line [" + line + "] in Module file [" + getFile() + "]"); try (FileReader reader = new FileReader(file))
{
try (BufferedReader buf = new BufferedReader(reader))
{
String line;
String sectionType = "";
while ((line = buf.readLine()) != null)
{
line = line.trim();
Matcher sectionMatcher = section.matcher(line);
if (sectionMatcher.matches())
{
sectionType = sectionMatcher.group(1).trim().toUpperCase();
}
else
{
// blank lines and comments are valid for initialize section
if (line.length() == 0 || line.startsWith("#"))
{
if ("INI".equals(sectionType))
{
initialise.add(line);
}
}
else
{
switch (sectionType)
{
case "DEPEND":
parentNames.add(line);
break;
case "LIB":
libs.add(line);
break;
case "XML":
xmls.add(line);
break;
case "OPTIONAL":
optionalParentNames.add(line);
break;
case "DOWNLOAD":
downloads.add(line);
break;
case "INI":
initialise.add(line);
break;
}
}
}
}
}
}
} }
public void setDepth(int depth) public void setDepth(int depth)
@ -333,5 +349,4 @@ public class Module extends TextFile
str.append(']'); str.append(']');
return str.toString(); return str.toString();
} }
} }

View File

@ -39,76 +39,7 @@ import java.util.Set;
*/ */
public class StartArgs public class StartArgs
{ {
public static class DownloadArg
{
public String uri;
public String location;
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
DownloadArg other = (DownloadArg)obj;
if (uri == null)
{
if (other.uri != null)
{
return false;
}
}
else if (!uri.equals(other.uri))
{
return false;
}
if (location == null)
{
if (other.location != null)
{
return false;
}
}
else if (!location.equals(other.location))
{
return false;
}
return true;
}
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = (prime * result) + ((uri == null)?0:uri.hashCode());
result = (prime * result) + ((location == null)?0:location.hashCode());
return result;
}
@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("DownloadArg [uri=");
builder.append(uri);
builder.append(", location=");
builder.append(location);
builder.append("]");
return builder.toString();
}
}
public static final String CMD_LINE_SOURCE = "<cmd-line>"; public static final String CMD_LINE_SOURCE = "<cmd-line>";
public static final String VERSION; public static final String VERSION;
static static
@ -148,10 +79,8 @@ public class StartArgs
private List<String> jvmArgs = new ArrayList<>(); private List<String> jvmArgs = new ArrayList<>();
private List<String> moduleIni = new ArrayList<>(); private List<String> moduleIni = new ArrayList<>();
private List<String> moduleStartIni = new ArrayList<>(); private List<String> moduleStartIni = new ArrayList<>();
private List<String> modulePersistEnable = new ArrayList<>();
private List<String> modulePersistDisable = new ArrayList<>();
private Modules allModules;
private Modules allModules;
// Should the server be run? // Should the server be run?
private boolean run = true; private boolean run = true;
private boolean help = false; private boolean help = false;
@ -161,6 +90,7 @@ public class StartArgs
private boolean listConfig = false; private boolean listConfig = false;
private boolean version = false; private boolean version = false;
private boolean dryRun = false; private boolean dryRun = false;
private boolean exec = false; private boolean exec = false;
public StartArgs(String[] commandLineArgs) public StartArgs(String[] commandLineArgs)
@ -169,30 +99,9 @@ public class StartArgs
classpath = new Classpath(); classpath = new Classpath();
} }
static DownloadArg toDownloadArg(String uriLocation)
{
String parts[] = uriLocation.split(":",3);
if (parts.length != 3)
{
throw new IllegalArgumentException("Not <http uri>:<location>");
}
if (!"http".equalsIgnoreCase(parts[0]))
{
throw new IllegalArgumentException("Download only supports http protocol");
}
if (!parts[1].startsWith("//"))
{
throw new IllegalArgumentException("Download URI invalid: " + uriLocation);
}
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) private void addDownload(String uriLocation)
{ {
DownloadArg arg=toDownloadArg(uriLocation); DownloadArg arg = new DownloadArg(uriLocation);
if (!downloads.contains(arg)) if (!downloads.contains(arg))
{ {
downloads.add(arg); downloads.add(arg);
@ -452,16 +361,6 @@ public class StartArgs
return this.commandLine; return this.commandLine;
} }
public List<String> getModuleIni()
{
return moduleIni;
}
public List<String> getModuleStartIni()
{
return moduleStartIni;
}
public List<DownloadArg> getDownloads() public List<DownloadArg> getDownloads()
{ {
@ -540,14 +439,14 @@ public class StartArgs
return System.getProperty("main.class",mainclass); return System.getProperty("main.class",mainclass);
} }
public List<String> getModulePersistDisable() public List<String> getModuleIni()
{ {
return modulePersistDisable; return moduleIni;
} }
public List<String> getModulePersistEnable() public List<String> getModuleStartIni()
{ {
return modulePersistEnable; return moduleStartIni;
} }
public Properties getProperties() public Properties getProperties()
@ -648,11 +547,6 @@ public class StartArgs
return listModules; return listModules;
} }
public boolean isModulePersistenceChanging()
{
return (modulePersistDisable.size() > 0) || (modulePersistEnable.size() > 0);
}
public boolean isRun() public boolean isRun()
{ {
return run; return run;
@ -685,10 +579,24 @@ public class StartArgs
} }
} }
public void parse(String arg, String source) public void parse(final String rawarg, String source)
{
if (rawarg == null)
{ {
if (arg.trim().startsWith("#"))
return; return;
}
final String arg = rawarg.trim();
if (arg.length() <= 0)
{
return;
}
if (arg.startsWith("#"))
{
return;
}
if ("--help".equals(arg) || "-?".equals(arg)) if ("--help".equals(arg) || "-?".equals(arg))
{ {
@ -768,7 +676,9 @@ public class StartArgs
if (arg.startsWith("--module-ini=")) if (arg.startsWith("--module-ini="))
{ {
if (!CMD_LINE_SOURCE.equals(source)) if (!CMD_LINE_SOURCE.equals(source))
{
throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source); throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source);
}
moduleIni.addAll(getValues(arg)); moduleIni.addAll(getValues(arg));
run = false; run = false;
return; return;
@ -777,7 +687,9 @@ public class StartArgs
if (arg.startsWith("--module-start-ini=")) if (arg.startsWith("--module-start-ini="))
{ {
if (!CMD_LINE_SOURCE.equals(source)) if (!CMD_LINE_SOURCE.equals(source))
{
throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source); throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source);
}
moduleStartIni.addAll(getValues(arg)); moduleStartIni.addAll(getValues(arg));
run = false; run = false;
return; return;
@ -799,28 +711,6 @@ public class StartArgs
return; return;
} }
if (arg.startsWith("--enable-module="))
{
if (!CMD_LINE_SOURCE.equals(source))
{
throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source);
}
modulePersistEnable.addAll(getValues(arg));
run = false;
return;
}
if (arg.startsWith("--disable-module="))
{
if (!CMD_LINE_SOURCE.equals(source))
{
throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source);
}
modulePersistDisable.addAll(getValues(arg));
run = false;
return;
}
// Start property (syntax similar to System property) // Start property (syntax similar to System property)
if (arg.startsWith("-D")) if (arg.startsWith("-D"))
{ {
@ -873,7 +763,7 @@ public class StartArgs
} }
// Anything else is unrecognized // Anything else is unrecognized
throw new UsageException(ERR_BAD_ARG,"Unrecognized argument: %s in %s",arg,source); throw new UsageException(ERR_BAD_ARG,"Unrecognized argument: \"%s\" in %s",arg,source);
} }
public void parseCommandLine() public void parseCommandLine()
@ -904,16 +794,6 @@ public class StartArgs
this.allModules = allModules; this.allModules = allModules;
} }
public void setModulePersistDisable(List<String> modulePersistDisable)
{
this.modulePersistDisable = modulePersistDisable;
}
public void setModulePersistEnable(List<String> modulePersistEnable)
{
this.modulePersistEnable = modulePersistEnable;
}
@Override @Override
public String toString() public String toString()
{ {

View File

@ -59,23 +59,28 @@ Module Management:
o The ${jetty.base}/start.d/*.ini files o The ${jetty.base}/start.d/*.ini files
--module=<modulename> --module=<modulename>
Will temporarily enable a module from the command line. Temporarily enable a module from the command line.
Note: this can also be used in the ${jetty.base}/start.ini Note: this can also be used in the ${jetty.base}/start.ini
or ${jetty.base}/start.d/*.ini files. or ${jetty.base}/start.d/*.ini files.
--module-ini=<modulename> --module-ini=<modulename>
Will enable a module by adding an ini file to the Enable a module via creation of an ini file in the
${jetty.base}/start.d/ directory from the template ${jetty.base}/start.d/ directory.
contained in the module definition. Transitive Uses ini template that the module itself maintains.
dependencies are followed and ini files are created Transitive module dependencies are followed and all
for them if they too have a ini template. modules that the specified module depends on are also
enabled via their own ini files in the same directory.
Note: not all modules have ini templates.
--module-start-ini=<modulename> --module-start-ini=<modulename>
Will enable a module by appending lines to the Enable a module by appending lines to the
${jetty.base}/start.ini file from the template ${jetty.base}/start.ini file.
contained in the module definition. Transitive Lines that are added come from the ini template that
dependencies are followed and lines are appended the module itself maintains.
for them if they too have a ini template. Transitive module dependencies are followed and all
modules that the specified module depends on are also
enabled in the ${jetty.base}/start.ini using the same
techniques.
Startup / Shutdown Command Line: Startup / Shutdown Command Line:
-------------------------------- --------------------------------

View File

@ -39,7 +39,7 @@ public class BaseHomeTest
{ {
actual.add(hb.toShortForm(file)); actual.add(hb.toShortForm(file));
} }
Assert.assertThat(message,actual,containsInAnyOrder(expected.toArray())); Assert.assertThat(message + ": " + Main.join(actual,", "),actual,containsInAnyOrder(expected.toArray()));
} }
@Test @Test
@ -84,7 +84,7 @@ public class BaseHomeTest
File baseDir = null; File baseDir = null;
BaseHome hb = new BaseHome(homeDir,baseDir); BaseHome hb = new BaseHome(homeDir,baseDir);
List<File> files = hb.listFiles("/start.d", new FS.IniFilter()); List<File> files = hb.listFiles("/start.d",new FS.IniFilter());
List<String> expected = new ArrayList<>(); List<String> expected = new ArrayList<>();
expected.add("${jetty.home}/start.d/jmx.ini"); expected.add("${jetty.home}/start.d/jmx.ini");
@ -120,6 +120,8 @@ public class BaseHomeTest
public void testDefault() throws IOException public void testDefault() throws IOException
{ {
BaseHome bh = new BaseHome(); BaseHome bh = new BaseHome();
Assert.assertThat("Home",bh.getHome(),notNullValue());
Assert.assertThat("Base",bh.getBase(),notNullValue());
} }
@Test @Test

View File

@ -31,7 +31,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.eclipse.jetty.start.StartArgs.DownloadArg;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.junit.Assert; import org.junit.Assert;

View File

@ -42,7 +42,7 @@ public class ModulesTest
Modules modules = new Modules(); Modules modules = new Modules();
modules.registerAll(basehome); modules.registerAll(basehome);
Assert.assertThat("Module count",modules.count(),is(29)); Assert.assertThat("Module count",modules.count(),is(28));
} }
@Test @Test

View File

@ -67,5 +67,4 @@ public class TestUseCases
{ {
assertUseCase("home","base.with.db","assert-with-db.txt"); assertUseCase("home","base.with.db","assert-with-db.txt");
} }
} }

View File

@ -1 +1,2 @@
LIB=lib/example*with spaces.jar [lib]
lib/example*with spaces.jar

View File

@ -1,8 +1,11 @@
DEPEND=deploy [depend]
DEPEND=jndi deploy
DEPEND=plus jndi
plus
LIB=lib/db/*.jar [lib]
lib/db/*.jar
[xml]
etc/jetty-db.xml etc/jetty-db.xml

View File

@ -1,13 +0,0 @@
# this should not be picked up as there is a module persistence layer present
--module=debug
--module=ipaccess
--module=rewrite
jetty.port=12345
jetty.keystore=etc/keystore
jetty.keystore.password=friendly
jetty.keymanager.password=icecream
jetty.truststore=etc/keystore
jetty.truststore.password=sundae

View File

@ -2,13 +2,16 @@
# Jetty Annotation Scanning Module # Jetty Annotation Scanning Module
# #
[depend]
# Annotations needs plus, and jndi features # Annotations needs plus, and jndi features
DEPEND=plus plus
[lib]
# Annotations needs jetty annotation jars # Annotations needs jetty annotation jars
LIB=lib/jetty-annotations-${jetty.version}.jar lib/jetty-annotations-${jetty.version}.jar
# Need annotation processing jars too # Need annotation processing jars too
LIB=lib/annotations/*.jar lib/annotations/*.jar
[xml]
# Enable annotation scanning webapp configurations # Enable annotation scanning webapp configurations
etc/jetty-annotations.xml etc/jetty-annotations.xml

View File

@ -2,7 +2,10 @@
# Base Module # Base Module
# #
OPTIONAL=jmx [optional]
# JMX is optional, if it appears in the module tree then depend on it
jmx
LIB=lib/jetty-util-${jetty.version}.jar [lib]
LIB=lib/jetty-io-${jetty.version}.jar lib/jetty-util-${jetty.version}.jar
lib/jetty-io-${jetty.version}.jar

View File

@ -2,5 +2,6 @@
# Client Feature # Client Feature
# #
[lib]
# Client jars # Client jars
LIB=lib/jetty-client-${jetty.version}.jar lib/jetty-client-${jetty.version}.jar

View File

@ -2,6 +2,8 @@
# Debug module # Debug module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-debug.xml etc/jetty-debug.xml

View File

@ -1,16 +0,0 @@
#
# Jetty Demo Module
#
DEPEND=jndi
DEPEND=jaas
DEPEND=rewrite
DEPEND=client
DEPEND=annotations
DEPEND=websocket
DEPEND=webapp
LIB=demo/lib/*.jar
demo/test-realm.xml
demo/jetty-demo.xml

View File

@ -2,10 +2,13 @@
# Deploy Feature # Deploy Feature
# #
DEPEND=webapp [depend]
webapp
[lib]
# Deploy jars # Deploy jars
LIB=lib/jetty-deploy-${jetty.version}.jar lib/jetty-deploy-${jetty.version}.jar
[xml]
# Deploy configuration # Deploy configuration
etc/jetty-deploy.xml etc/jetty-deploy.xml

View File

@ -2,6 +2,8 @@
# Jetty HTTP Server # Jetty HTTP Server
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-http.xml etc/jetty-http.xml

View File

@ -2,7 +2,9 @@
# Jetty HTTP Server # Jetty HTTP Server
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-ssl.xml etc/jetty-ssl.xml
etc/jetty-https.xml etc/jetty-https.xml

View File

@ -2,6 +2,8 @@
# IPAccess module # IPAccess module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-ipaccess.xml etc/jetty-ipaccess.xml

View File

@ -2,10 +2,13 @@
# JAAS Feature # JAAS Feature
# #
DEPEND=server [depend]
server
[lib]
# JAAS jars # JAAS jars
LIB=lib/jetty-jaas-${jetty.version}.jar lib/jetty-jaas-${jetty.version}.jar
[xml]
# JAAS configuration # JAAS configuration
etc/jetty-jaas.xml etc/jetty-jaas.xml

View File

@ -2,8 +2,10 @@
# JMX Feature # JMX Feature
# #
[lib]
# JMX jars (as defined in start.config) # JMX jars (as defined in start.config)
LIB=lib/jetty-jmx-${jetty.version}.jar lib/jetty-jmx-${jetty.version}.jar
[xml]
# JMX configuration # JMX configuration
etc/jetty-jmx.xml etc/jetty-jmx.xml

View File

@ -2,8 +2,10 @@
# JNDI Support # JNDI Support
# #
DEPEND=server [depend]
server
LIB=lib/jetty-jndi-${jetty.version}.jar [lib]
LIB=lib/jndi/*.jar lib/jetty-jndi-${jetty.version}.jar
lib/jndi/*.jar

View File

@ -2,7 +2,9 @@
# Jetty Servlet Module # Jetty Servlet Module
# #
DEPEND=servlet [depend]
servlet
LIB=lib/jsp/*.jar [lib]
lib/jsp/*.jar

View File

@ -2,6 +2,8 @@
# Low Resources module # Low Resources module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-lowresources.xml etc/jetty-lowresources.xml

View File

@ -2,9 +2,12 @@
# Jetty Monitor module # Jetty Monitor module
# #
DEPEND=server [depend]
DEPEND=client server
client
LIB=lib/jetty-monitor-${jetty.version}.jar [lib]
lib/jetty-monitor-${jetty.version}.jar
[xml]
etc/jetty-monitor.xml etc/jetty-monitor.xml

View File

@ -1,4 +1,6 @@
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 [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
INI=-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

@ -2,11 +2,14 @@
# Jetty Proxy module # Jetty Proxy module
# #
DEPEND=server [depend]
DEPEND=security server
DEPEND=jndi security
jndi
LIB=lib/jetty-plus-${jetty.version}.jar [lib]
lib/jetty-plus-${jetty.version}.jar
[xml]
# Plus requires configuration # Plus requires configuration
etc/jetty-plus.xml etc/jetty-plus.xml

View File

@ -2,10 +2,13 @@
# Jetty Proxy module # Jetty Proxy module
# #
DEPEND=server [depend]
DEPEND=client server
client
LIB=lib/jetty-proxy-${jetty.version}.jar [lib]
lib/jetty-proxy-${jetty.version}.jar
[xml]
# Proxy requires configuration # Proxy requires configuration
etc/jetty-proxy.xml etc/jetty-proxy.xml

View File

@ -2,6 +2,8 @@
# Request Log module # Request Log module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-requestlog.xml etc/jetty-requestlog.xml

View File

@ -2,9 +2,12 @@
# Jetty Rewrite module # Jetty Rewrite module
# #
DEPEND=server [depend]
server
LIB=lib/jetty-rewrite-${jetty.version}.jar [lib]
lib/jetty-rewrite-${jetty.version}.jar
[xml]
# Annotations needs annotations configuration # Annotations needs annotations configuration
etc/jetty-rewrite.xml etc/jetty-rewrite.xml

View File

@ -2,6 +2,8 @@
# Jetty Security Module # Jetty Security Module
# #
DEPEND=server [depend]
server
LIB=lib/jetty-security-${jetty.version}.jar [lib]
lib/jetty-security-${jetty.version}.jar

View File

@ -2,14 +2,17 @@
# Base server # Base server
# #
DEPEND=base [depend]
DEPEND=xml base
xml
LIB=lib/servlet-api-3.1.jar [lib]
LIB=lib/jetty-schemas-3.1.jar lib/servlet-api-3.1.jar
LIB=lib/jetty-http-${jetty.version}.jar lib/jetty-schemas-3.1.jar
LIB=lib/jetty-continuation-${jetty.version}.jar lib/jetty-http-${jetty.version}.jar
LIB=lib/jetty-server-${jetty.version}.jar lib/jetty-continuation-${jetty.version}.jar
lib/jetty-server-${jetty.version}.jar
[xml]
# Annotations needs annotations configuration # Annotations needs annotations configuration
etc/jetty.xml etc/jetty.xml

View File

@ -2,6 +2,8 @@
# Jetty Servlet Module # Jetty Servlet Module
# #
DEPEND=server [depend]
server
LIB=lib/jetty-servlet-${jetty.version}.jar [lib]
lib/jetty-servlet-${jetty.version}.jar

View File

@ -1,8 +1,11 @@
DEPEND=server [depend]
DEPEND=npn server
npn
LIB=lib/spdy/*.jar [lib]
lib/spdy/*.jar
[xml]
etc/jetty-ssl.xml etc/jetty-ssl.xml
etc/jetty-spdy.xml etc/jetty-spdy.xml

View File

@ -2,6 +2,8 @@
# Stats module # Stats module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-stats.xml etc/jetty-stats.xml

View File

@ -2,6 +2,8 @@
# Base server # Base server
# #
DEPEND=servlet [depend]
servlet
LIB=lib/jetty-webapp-${jetty.version}.jar [lib]
lib/jetty-webapp-${jetty.version}.jar

View File

@ -3,12 +3,15 @@
# #
# WebSocket needs Annotations feature # WebSocket needs Annotations feature
DEPEND=server [depend]
DEPEND=annotations server
annotations
# WebSocket needs websocket jars (as defined in start.config) # WebSocket needs websocket jars (as defined in start.config)
LIB=lib/websocket/*.jar [lib]
lib/websocket/*.jar
# WebSocket needs websocket configuration # WebSocket needs websocket configuration
[xml]
etc/jetty-websockets.xml etc/jetty-websockets.xml

View File

@ -2,6 +2,8 @@
# Stats module # Stats module
# #
DEPEND=server [depend]
server
[xml]
etc/jetty-xinetd.xml etc/jetty-xinetd.xml

View File

@ -2,7 +2,9 @@
# Jetty XML Configuration # Jetty XML Configuration
# #
DEPEND=base [depend]
base
LIB=lib/jetty-xml-${jetty.version}.jar [lib]
lib/jetty-xml-${jetty.version}.jar

View File

@ -2,6 +2,8 @@
# Base server # Base server
# #
DEPEND=servlet [depend]
servlet
LIB=lib/jetty-webapp-${jetty.version}.jar [lib]
lib/jetty-webapp-${jetty.version}.jar

View File

@ -2,13 +2,16 @@
# WebSocket Feature # WebSocket Feature
# #
[depend]
# WebSocket needs Annotations feature # WebSocket needs Annotations feature
DEPEND=server server
DEPEND=annotations annotations
[lib]
# WebSocket needs websocket jars (as defined in start.config) # WebSocket needs websocket jars (as defined in start.config)
LIB=lib/websocket/*.jar lib/websocket/*.jar
[xml]
# WebSocket needs websocket configuration # WebSocket needs websocket configuration
etc/jetty-websockets.xml etc/jetty-websockets.xml

View File

@ -34,7 +34,7 @@
<!-- Mandatory. This system property tells JAAS where to find the login module configuration file --> <!-- Mandatory. This system property tells JAAS where to find the login module configuration file -->
<systemProperty> <systemProperty>
<name>java.security.auth.login.config</name> <name>java.security.auth.login.config</name>
<value>${basedir}/src/main/config/demo/login.conf</value> <value>${basedir}/src/main/config/demo-base/etc/login.conf</value>
</systemProperty> </systemProperty>
</systemProperties> </systemProperties>
<webAppConfig> <webAppConfig>

View File

@ -1,5 +1,5 @@
xyz { xyz {
org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required
debug="true" debug="true"
file="${jetty.home}/demo/login.properties"; file="${jetty.base}/etc/login.properties";
}; };

View File

@ -24,7 +24,7 @@
etc/jetty-jaas.xml etc/jetty-jaas.xml
</pre> </pre>
</p> </p>
<p>For the jetty distribution demos, jaas is already enabled in the start.d/900-demo.ini file and sets the jaas.login.conf property to demo/login.conf for use with the demo/webapps/test-jaas.war web application. </p> <p>For the jetty distribution demos, jaas is already enabled in the demo-base/start.ini file and sets the jaas.login.conf property to ${jetty.base}/etc/login.conf for use with the demo-base/webapps/test-jaas.war web application. </p>
<p>The full source of this demonstration is available <a <p>The full source of this demonstration is available <a
href="http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/tests/test-webapps/test-jaas-webapp">here</a>.</p> href="http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/tests/test-webapps/test-jaas-webapp">here</a>.</p>

View File

@ -147,7 +147,7 @@
<loginServices> <loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService"> <loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>Test Realm</name> <name>Test Realm</name>
<config>src/main/config/demo/realm.properties</config> <config>src/main/config/demo-base/etc/realm.properties</config>
</loginService> </loginService>
</loginServices> </loginServices>
</configuration> </configuration>

View File

@ -28,7 +28,7 @@ detected.
<Set name="extractWAR">true</Set> <Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set> <Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set> <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="overrideDescriptor"><SystemProperty name="jetty.base" default="."/>/demo/override-web.xml</Set> <Set name="overrideDescriptor"><SystemProperty name="jetty.base" default="."/>/etc/override-web.xml</Set>
<!-- virtual hosts <!-- virtual hosts
<Set name="virtualHosts"> <Set name="virtualHosts">

View File

@ -27,7 +27,7 @@
<destName>jetty-web.xml</destName> <destName>jetty-web.xml</destName>
</file> </file>
<file> <file>
<source>src/main/config/demo/realm.properties</source> <source>src/main/config/demo-base/etc/realm.properties</source>
<outputDirectory>WEB-INF</outputDirectory> <outputDirectory>WEB-INF</outputDirectory>
<destName>realm.properties</destName> <destName>realm.properties</destName>
</file> </file>

View File

@ -6,26 +6,6 @@
<!-- =============================================================== --> <!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server"> <Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- ============================================================= -->
<!-- Add demo/webapps to deployment manager scans -->
<!-- ============================================================= -->
<Ref refid="DeploymentManager">
<Call id="webappprovider" name="addAppProvider">
<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.home" default="." />/etc/webdefault.xml</Set>
<Set name="scanInterval">1</Set>
<Set name="extractWars">true</Set>
<Set name="configurationManager">
<New class="org.eclipse.jetty.deploy.PropertiesConfigurationManager"/>
</Set>
</New>
</Arg>
</Call>
</Ref>
<!-- ============================================================= --> <!-- ============================================================= -->
<!-- Add rewrite rules --> <!-- Add rewrite rules -->
<!-- ============================================================= --> <!-- ============================================================= -->

View File

@ -12,7 +12,7 @@
<Arg> <Arg>
<New class="org.eclipse.jetty.security.HashLoginService"> <New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set> <Set name="name">Test Realm</Set>
<Set name="config"><Property name="demo.realm" default="demo/realm.properties"/></Set> <Set name="config"><Property name="demo.realm" default="etc/realm.properties"/></Set>
<Set name="refreshInterval">0</Set> <Set name="refreshInterval">0</Set>
</New> </New>
</Arg> </Arg>

Some files were not shown because too many files have changed in this diff Show More