310094 Improved start.jar usage and config files

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1548 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-04-22 12:59:40 +00:00
parent 5731200946
commit 4fe6fa388f
14 changed files with 358 additions and 231 deletions

View File

@ -12,6 +12,7 @@ jetty-7.1-SNAPSHOT
+ 309466 Removed synchronization from StdErrLog + 309466 Removed synchronization from StdErrLog
+ 309765 Added JSP module + 309765 Added JSP module
+ 310051 _configurationClasses now defaults to null in WebAppContext + 310051 _configurationClasses now defaults to null in WebAppContext
+ 310094 Improved start.jar usage and config files
+ JETTY-903 Stop both caches + JETTY-903 Stop both caches
+ JETTY-1200 SSL NIO Endpoint wraps non NIO buffers + JETTY-1200 SSL NIO Endpoint wraps non NIO buffers
+ JETTY-1202 Use platform default algorithm for SecureRandom + JETTY-1202 Use platform default algorithm for SecureRandom

View File

@ -26,6 +26,23 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>config.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<!-- <!--
Required for OSGI Required for OSGI

View File

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure the Jetty Deployers -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Configure the deployment manager -->
<!-- -->
<!-- Sets up 2 monitored dir app providers that are configured -->
<!-- to behave in a similaraly to the legacy ContextDeployer -->
<!-- and WebAppDeployer from previous versions of Jetty. -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
<Set name="contexts">
<Ref id="Contexts" />
</Set>
<Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
</Call>
<!-- Providers of Apps via Context XML files.
Configured to behave similar to the legacy ContextDeployer -->
<Call name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="monitoredDir"><SystemProperty name="jetty.home" default="." />/contexts</Set>
<Set name="scanInterval">5</Set>
</New>
</Arg>
</Call>
<!-- Providers of Apps via WAR file existence.
Configured to behave similar to the legacy WebAppDeployer -->
<Call name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDir"><SystemProperty name="jetty.home" default="." />/webapps</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="scanInterval">5</Set>
<Set name="contextXmlDir"><SystemProperty name="jetty.home" default="." />/contexts</Set>
</New>
</Arg>
</Call>
</New>
</Arg>
</Call>
</Configure>

View File

@ -15,7 +15,7 @@
<Array type="org.eclipse.jetty.deploy.AppProvider"> <Array type="org.eclipse.jetty.deploy.AppProvider">
<Item> <Item>
<New class="org.eclipse.jetty.deploy.providers.ContextProvider"> <New class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="monitoredDir"><Property name="jetty.home" />/contexts</Set> <Set name="monitoredDir"><SystemProperty name="jetty.home" />/contexts</Set>
<Set name="scanInterval">1</Set> <Set name="scanInterval">1</Set>
<Set name="configurationManager"> <Set name="configurationManager">
<New class="org.eclipse.jetty.deploy.FileConfigurationManager"> <New class="org.eclipse.jetty.deploy.FileConfigurationManager">
@ -28,9 +28,9 @@
</Item> </Item>
<Item> <Item>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider"> <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDir"><Property name="jetty.home" />/webapps</Set> <Set name="monitoredDir"><SystemProperty name="jetty.home" />/webapps</Set>
<Set name="scanInterval">1</Set> <Set name="scanInterval">1</Set>
<Set name="contextXmlDir"><Property name="jetty.home" />/contexts</Set> <Set name="contextXmlDir"><SystemProperty name="jetty.home" />/contexts</Set>
</New> </New>
</Item> </Item>
</Array> </Array>

View File

@ -143,6 +143,16 @@
<includes>**</includes> <includes>**</includes>
<outputDirectory>${assembly.directory}</outputDirectory> <outputDirectory>${assembly.directory}</outputDirectory>
</artifactItem> </artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>
<version>${project.version}</version>
<classifier>config</classifier>
<type>jar</type>
<overWrite>true</overWrite>
<includes>**</includes>
<outputDirectory>${assembly.directory}</outputDirectory>
</artifactItem>
<artifactItem> <artifactItem>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId> <artifactId>jetty-plus</artifactId>

View File

@ -1,10 +1,13 @@
#=========================================================== #===========================================================
# Jetty start.jar arguments # Jetty start.jar arguments
#-----------------------------------------------------------
# Each line of this file is prepended to the command line # Each line of this file is prepended to the command line
# arguments # of a call to: # arguments # of a call to:
# java -jar start.jar [arg...] # java -jar start.jar [arg...]
# #===========================================================
#===========================================================
# If the arguements in this file include JVM arguments # If the arguements in this file include JVM arguments
# (eg -Xmx512m) or JVM System properties (eg com.sun.???), # (eg -Xmx512m) or JVM System properties (eg com.sun.???),
# then these will not take affect unless the --exec # then these will not take affect unless the --exec
@ -12,20 +15,46 @@
# is executed like: # is executed like:
# eval $(java -jar start.jar --dry-run) # eval $(java -jar start.jar --dry-run)
# #
#=========================================================== # Below are some recommended options for Sun's JRE
OPTIONS=Server,jsp,jmx,resources,websocket,ext
#===========================================================
# The following is an example of the ini args to run the
# server with a heap size, JMX remote enabled, JMX mbeans
# and ssl
#----------------------------------------------------------- #-----------------------------------------------------------
# --exec # --exec
# -Xmx512m
# -Dcom.sun.management.jmxremote # -Dcom.sun.management.jmxremote
# OPTIONS=Server,jmx,resources # -Xmx2000m
# etc/jetty-jmx.xml # -Xmn512m
# etc/jetty.xml # -verbose:gc
# etc/jetty-ssl.xml # -XX:+PrintGCDateStamps
# -XX:+PrintGCTimeStamps
# -XX:+PrintGCDetails
# -XX:+PrintTenuringDistribution
# -XX:+PrintCommandLineFlags
# -XX:+DisableExplicitGC
# -XX:+UseConcMarkSweepGC
# -XX:ParallelCMSThreads=2
# -XX:+CMSClassUnloadingEnabled
# -XX:+UseCMSCompactAtFullCollection
# -XX:CMSInitiatingOccupancyFraction=80
#-----------------------------------------------------------
#===========================================================
# Start classpath OPTIONS.
# These control what classes are on the classpath
# for a full listing do
# java -jar start.jar --list-options
#-----------------------------------------------------------
OPTIONS=Server,jsp,jmx,resources,websocket,ext
#-----------------------------------------------------------
#===========================================================
# Configuration files.
# For a full list of available configuration files do
# java -jar start.jar --help
#-----------------------------------------------------------
#etc/jetty-jmx.xml
etc/jetty.xml
# etc/jetty-ssl.xml
# etc/jetty-requestlog.xml
etc/jetty-deploy.xml
etc/jetty-testrealm.xml
#=========================================================== #===========================================================

View File

@ -63,10 +63,10 @@
<Call name="addAppProvider"> <Call name="addAppProvider">
<Arg> <Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider"> <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDir"><Property name="jetty.home" default="." />/webapps-plus</Set> <Set name="monitoredDir"><SystemProperty name="jetty.home" default="." />/webapps-plus</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="scanInterval">5</Set> <Set name="scanInterval">5</Set>
<Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set> <Set name="contextXmlDir"><SystemProperty name="jetty.home" default="." />/contexts</Set>
<Set name="parentLoaderPriority">false</Set> <Set name="parentLoaderPriority">false</Set>
<Set name="extractWars">true</Set> <Set name="extractWars">true</Set>
<Set name="configurationClasses"><Ref id="plusConfig"/></Set> <Set name="configurationClasses"><Ref id="plusConfig"/></Set>

View File

@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure the Jetty Request Log -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Configure Request Log -->
<!-- =========================================================== -->
<Ref id="Handlers">
<Call name="addHandler">
<Arg>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Set name="filename"><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.request.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</New>
</Arg>
</Call>
</Ref>
</Configure>

View File

@ -5,8 +5,13 @@
<!-- Configure the Jetty Server --> <!-- Configure the Jetty Server -->
<!-- --> <!-- -->
<!-- Documentation of this file format can be found at: --> <!-- Documentation of this file format can be found at: -->
<!-- http://docs.codehaus.org/display/JETTY/jetty.xml --> <!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax -->
<!-- --> <!-- -->
<!-- Additional configuration files are available in $JETTY_HOME/etc -->
<!-- and can be mixed in. For example: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
<!-- -->
<!-- See start.ini file for the default configuraton files -->
<!-- =============================================================== --> <!-- =============================================================== -->
@ -23,8 +28,6 @@
</New> </New>
</Set> </Set>
<!-- =========================================================== --> <!-- =========================================================== -->
<!-- Set connectors --> <!-- Set connectors -->
<!-- =========================================================== --> <!-- =========================================================== -->
@ -44,26 +47,6 @@
</Arg> </Arg>
</Call> </Call>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To add a HTTPS SSL connector -->
<!-- mixin jetty-ssl.xml: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To add a HTTP blocking connector -->
<!-- mixin jetty-bio.xml: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-bio.xml -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- To allow Jetty to be started from xinetd -->
<!-- mixin jetty-xinetd.xml: -->
<!-- java -jar start.jar etc/jetty.xml etc/jetty-xinetd.xml -->
<!-- -->
<!-- See jetty-xinetd.xml for further instructions. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- =========================================================== --> <!-- =========================================================== -->
<!-- Set handler Collection Structure --> <!-- Set handler Collection Structure -->
<!-- =========================================================== --> <!-- =========================================================== -->
@ -77,95 +60,11 @@
<Item> <Item>
<New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/> <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
</Item> </Item>
<Item>
<New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
</Item>
</Array> </Array>
</Set> </Set>
</New> </New>
</Set> </Set>
<!-- =========================================================== -->
<!-- Configure the deployment manager -->
<!-- -->
<!-- Sets up 2 monitored dir app providers that are configured -->
<!-- to behave in a similaraly to the legacy ContextDeployer -->
<!-- and WebAppDeployer from previous versions of Jetty. -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
<Set name="contexts">
<Ref id="Contexts" />
</Set>
<Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
</Call>
<!-- Providers of Apps via Context XML files.
Configured to behave similar to the legacy ContextDeployer -->
<Call name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="monitoredDir"><Property name="jetty.home" default="." />/contexts</Set>
<Set name="scanInterval">5</Set>
</New>
</Arg>
</Call>
<!-- Providers of Apps via WAR file existence.
Configured to behave similar to the legacy WebAppDeployer -->
<Call name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDir"><Property name="jetty.home" default="." />/webapps</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="scanInterval">5</Set>
<Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
</New>
</Arg>
</Call>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure Authentication Login Service -->
<!-- Realms may be configured for the entire server here, or -->
<!-- they can be configured for a specific web app in a context -->
<!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
<!-- example). -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>
</Call>
<!-- =========================================================== -->
<!-- Configure Request Log -->
<!-- Request logs may be configured for the entire server here, -->
<!-- or they can be configured for a specific web app in a -->
<!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
<!-- for an example). -->
<!-- =========================================================== -->
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Set name="filename"><SystemProperty name="jetty.home" default="."/>/logs/yyyy_mm_dd.request.log</Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="logCookies">false</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
<!-- =========================================================== --> <!-- =========================================================== -->
<!-- extra options --> <!-- extra options -->
<!-- =========================================================== --> <!-- =========================================================== -->

View File

@ -63,7 +63,7 @@ public class Main
private boolean _fromDaemon = false; private boolean _fromDaemon = false;
private final Config _config = new Config(); private final Config _config = new Config();
private Set<String> _sysProps = new HashSet<String>(); private Set<String> _sysProps = new HashSet<String>();
private List<String> _xArgs = new ArrayList<String>(); private List<String> _jvmArgs = new ArrayList<String>();
private String _jettyHome; private String _jettyHome;
@ -86,16 +86,35 @@ public class Main
{ {
List<String> arguments = new ArrayList<String>(); List<String> arguments = new ArrayList<String>();
// do we have any non option args
boolean has_args=false;
for (String arg : args)
has_args|=!arg.startsWith("-");
// if no non-option args, add the start.ini
if (!has_args)
arguments.addAll(loadStartIni()); // Add Arguments from start.ini (if it exists) arguments.addAll(loadStartIni()); // Add Arguments from start.ini (if it exists)
if (args.length>0)
arguments.addAll(Arrays.asList(args)); // Add Arguments on Command Line // add the command line args
for (String arg : args)
{
if ("%start.ini".equals(arg))
{
arguments.addAll(loadStartIni());
continue;
}
arguments.add(arg);
}
// The XML Configuration Files to initialize with // The XML Configuration Files to initialize with
List<String> xmls = new ArrayList<String>(); List<String> xmls = new ArrayList<String>();
// Process the arguments
for (String arg : arguments) for (String arg : arguments)
{ {
if ("--help".equals(arg))
if ("--help".equals(arg) || "-?".equals(arg))
{ {
_showUsage = true; _showUsage = true;
continue; continue;
@ -149,12 +168,6 @@ public class Main
continue; continue;
} }
if (arg.startsWith("-X"))
{
_xArgs.add(arg);
continue;
}
if (arg.startsWith("-D")) if (arg.startsWith("-D"))
{ {
String[] assign = arg.substring(2).split("=",2); String[] assign = arg.substring(2).split("=",2);
@ -173,14 +186,27 @@ public class Main
continue; continue;
} }
if (arg.startsWith("-"))
{
_jvmArgs.add(arg);
continue;
}
// Is this a Property? // Is this a Property?
else if (arg.indexOf('=') >= 0) if (arg.indexOf('=') >= 0)
{ {
String[] assign = arg.split("=",2); String[] assign = arg.split("=",2);
switch(assign.length) switch(assign.length)
{ {
case 2: case 2:
if ("OPTIONS".equals(assign[0]))
{
String opts[] = assign[1].split(",");
for (String opt : opts)
_config.addActiveOption(opt);
}
else
this._config.setProperty(assign[0],assign[1]); this._config.setProperty(assign[0],assign[1]);
break; break;
case 1: case 1:
@ -189,6 +215,7 @@ public class Main
default: default:
break; break;
} }
continue; continue;
} }
@ -196,15 +223,6 @@ public class Main
xmls.add(arg); xmls.add(arg);
} }
// Special case for OPTIONS property
String options = _config.getProperty("OPTIONS");
if (options!=null)
{
String ids[] = options.split(",");
for (String id : ids)
_config.addActiveOption(id);
}
start(xmls); start(xmls);
} }
catch (Throwable t) catch (Throwable t)
@ -278,32 +296,32 @@ public class Main
while ((line = buf.readLine()) != null) while ((line = buf.readLine()) != null)
{ {
if (line.startsWith("@OPTIONS@")) if (line.endsWith("@") && line.indexOf('@')!=line.lastIndexOf('@'))
{
String indent=line.substring(0,line.indexOf("@"));
String info=line.substring(line.indexOf('@'),line.lastIndexOf('@'));
if (info.equals("@OPTIONS"))
{ {
List<String> sortedOptions = new ArrayList<String>(); List<String> sortedOptions = new ArrayList<String>();
sortedOptions.addAll(_config.getSectionIds()); sortedOptions.addAll(_config.getSectionIds());
Collections.sort(sortedOptions); Collections.sort(sortedOptions);
System.err.println(" Available OPTIONS: ");
for (String option : sortedOptions) for (String option : sortedOptions)
{ {
System.err.println(" [" + option + "]"); if ("*".equals(option) || option.trim().length()==0)
}
}
else if (line.startsWith("@CONFIGS@"))
{
System.err.println(" Configurations Available in ${jetty.home}/etc/: ");
File etc = new File(System.getProperty("jetty.home","."),"etc");
if (!etc.exists())
{
System.err.println(" Unable to find " + etc);
continue; continue;
System.out.print(indent);
System.out.println(option);
} }
}
if (!etc.isDirectory()) else if (info.equals("@CONFIGS"))
{ {
System.err.println(" Unable list dir " + etc); File etc = new File(System.getProperty("jetty.home","."),"etc");
if (!etc.exists() || !etc.isDirectory())
{
System.out.print(indent);
System.out.println("Unable to find/list " + etc);
continue; continue;
} }
@ -327,12 +345,32 @@ public class Main
for (File configFile : configFiles) for (File configFile : configFiles)
{ {
System.err.println(" etc/" + configFile.getName()); System.out.print(indent);
System.out.print("etc/");
System.out.println(configFile.getName());
}
}
else if (info.equals("@STARTINI"))
{
List<String> ini = loadStartIni();
if (ini!=null && ini.size()>0)
{
for (String a : ini)
{
System.out.print(indent);
System.out.println(a);
} }
} }
else else
{ {
System.err.println(line); System.out.print(indent);
System.out.println("none");
}
}
}
else
{
System.out.println(line);
} }
} }
} }
@ -380,7 +418,8 @@ public class Main
if (invoked_class == null) if (invoked_class == null)
{ {
usage(); System.err.println("Usage: java -jar start.jar [options] [properties] [configs]");
System.err.println(" java -jar start.jar --help # for more information");
return; return;
} }
} }
@ -516,7 +555,7 @@ public class Main
return; return;
} }
if (_xArgs.size()>0 || _sysProps.size()>0) if (_jvmArgs.size()>0 || _sysProps.size()>0)
System.err.println("WARNING: System properties and/or JVM args set. Consider using --dry-run or --exec"); System.err.println("WARNING: System properties and/or JVM args set. Consider using --dry-run or --exec");
// Set current context class loader to what is selected. // Set current context class loader to what is selected.
@ -609,18 +648,18 @@ public class Main
{ {
StringBuilder cmd = new StringBuilder(); StringBuilder cmd = new StringBuilder();
cmd.append(findJavaBin()); cmd.append(findJavaBin());
for (String x:_xArgs) for (String x:_jvmArgs)
cmd.append(' ').append(x); cmd.append(' ').append(x);
cmd.append(" -Djetty.home=").append(_jettyHome); cmd.append(" -Djetty.home=").append(_jettyHome);
for (String p:_sysProps) for (String p:_sysProps)
{ {
cmd.append(" -D").append(p); cmd.append(" -D").append(p);
String v=System.getProperty(p); String v=System.getProperty(p);
if (v!=null) if (v!=null && v.length()>0)
cmd.append('=').append(v); cmd.append('=').append(v);
} }
cmd.append(" -cp ").append(classpath.toString()); cmd.append(" -cp ").append(classpath.toString());
cmd.append(' ').append(_config.getMainClassname()); cmd.append(" ").append(_config.getMainClassname());
for (String xml : xmls) for (String xml : xmls)
{ {
cmd.append(' ').append(xml); cmd.append(' ').append(xml);

View File

@ -139,13 +139,17 @@ $(jetty.home)/lib/setuid/**
$(jetty.home)/lib/jetty-policy-$(version).jar ! available org.eclipse.jetty.policy.JettyPolicy $(jetty.home)/lib/jetty-policy-$(version).jar ! available org.eclipse.jetty.policy.JettyPolicy
$(jetty.home)/lib/policy/jetty.policy $(jetty.home)/lib/policy/jetty.policy
[All,client] [All,Client,client]
$(jetty.home)/lib/jetty-http-$(version).jar ! available org.eclipse.jetty.http.HttpParser $(jetty.home)/lib/jetty-http-$(version).jar ! available org.eclipse.jetty.http.HttpParser
$(jetty.home)/lib/jetty-client-$(version).jar ! available org.eclipse.jetty.client.HttpClient $(jetty.home)/lib/jetty-client-$(version).jar ! available org.eclipse.jetty.client.HttpClient
[Client]
$(jetty.home)/lib/jetty-http-$(version).jar ! available org.eclipse.jetty.http.HttpParser
[All,websocket] [All,websocket]
$(jetty.home)/lib/jetty-websocket-$(version).jar ! available org.eclipse.jetty.websocket.WebSocket $(jetty.home)/lib/jetty-websocket-$(version).jar ! available org.eclipse.jetty.websocket.WebSocket
# Add ext if it exists # Add ext if it exists
[Server,All,default,ext] [Server,All,default,ext]
$(jetty.home)/lib/ext/** $(jetty.home)/lib/ext/**

View File

@ -1,58 +1,60 @@
Usage: java -jar start.jar [options] [properties] [configs] Usage: java -jar start.jar [options...] [properties...] [configs...]
The start.jar builds a classpath and executes a main java class with The start.jar builds a classpath and executes a main java class with
a classloader built from that classpath. By default the start.jar a classloader built from that classpath. By default the start.jar
mechanism is configured to start the jetty server, but it can be mechanism is configured to start the jetty server, but it can be
configured to start any java main class. configured to start any java main class.
Common Options: Command Line Options:
--help This help / usage information. --help This help / usage information.
--version Print the version information for Jetty, then exit.
--stop Stop the running Jetty instance.
Advanced Options: --version Print the version information for Jetty and
dependent jars, then exit.
--list-options List available options, then exit. --list-options List the details of each classpath OPTION
(see OPTION property in section below)
--dry-run Print the command line that the start.jar generates, --dry-run Print the command line that the start.jar generates,
then exit. This may be used to generate command lines then exit. This may be used to generate command lines
when the start.ini includes -X or -D arguments. when the start.ini includes -X or -D arguments.
On unix, the resulting command line can be run with
eval $(java -jar start.jar --dry-run)
This is more efficient than the --exec option, which
creates a second JVM instance
--exec Run the generated command line (see --dry-run) in --exec Run the generated command line (see --dry-run) in
a sub processes. This can be used when start.ini a sub processes. This can be used when start.ini
contains -X or -D arguments, but creates an extra contains -X or -D arguments, but creates an extra
JVM instance. JVM instance.
--secure Enable Security: --secure Enable Security:
* JVM Security Manager * JVM Security Manager
* Security Policies * Security Policies
* Secure Logging * Secure Logging
* Audit Logging * Audit Logging
If the file start.ini exists in the working directory, then it's each line --stop Stop the running Jetty instance.
of it's contents is prepended to the as an argument to the command line.
System Properties: System Properties:
These are set with a command line like "java -Dname=value ..." and are These are set with a command line like "java -Dname=value ..." and are
accessible via the java.lang.System#getProperty(String) API. accessible via the java.lang.System#getProperty(String) API.
Some key system properties are: Some key system properties are:
org.eclipse.jetty.util.log.class=[class] org.eclipse.jetty.util.log.class=[class]
A Low Level Jetty Logger Implementation to use A Low Level Jetty Logger Implementation to use
(default: org.eclipse.jetty.util.log.Slf4jLog) (default: org.eclipse.jetty.util.log.Slf4jLog)
org.eclipse.jetty.util.log.DEBUG=[boolean] org.eclipse.jetty.util.log.DEBUG=[boolean]
Debug logging for the stderr and javautil Loggers. Slf4j Debug logging for the stderr and javautil Loggers. Slf4j
and other loggers must be separately configured for debug. and other loggers must be separately configured for debug.
(default: false) (default: false)
org.eclipse.jetty.util.log.IGNORED=[boolean] org.eclipse.jetty.util.log.IGNORED=[boolean]
Ignored exceptions are logged, independent of DEBUG settings Ignored exceptions are logged, independent of DEBUG settings
(default: false) (default: false)
Start Properties: com.sun.management.jmxremote
Enable remote JMX management in Sun JVMS.
Properties:
These are set with a command line like "java -jar start.jar name=value" These are set with a command line like "java -jar start.jar name=value"
and only affect the start mechanism. Some of these are defined in the and only affect the start mechanism. Some of these are defined in the
default start.config and will not be available if another configuration default start.config and will not be available if another configuration
@ -61,29 +63,47 @@ Start Properties:
path=[directory] path=[directory]
An additional class path element to add to the started class path. Typically An additional class path element to add to the started class path. Typically
this is used to add directories of classes and/or resources this is used to add directories of classes and/or resources
lib=[directory] lib=[directory]
An additional library directory to add to the started class path. This must An additional library directory to add to the started class path. This must
be a (deep) directory of jars be a (deep) directory of jars
STOP.PORT=[number] STOP.PORT=[number]
The port to use to stop the running Jetty server. The port to use to stop the running Jetty server.
Required along with STOP.KEY if you want to use the --stop option above. Required along with STOP.KEY if you want to use the --stop option above.
STOP.KEY=[alphanumeric] STOP.KEY=[alphanumeric]
The passphrase defined to stop the server. The passphrase defined to stop the server.
Requried along with STOP.PORT if you want to use the --stop option above. Requried along with STOP.PORT if you want to use the --stop option above.
DEBUG=true DEBUG=true
Enable debug on the start mechanism and sets the Enable debug on the start mechanism and sets the
org.eclipse.jetty.util.log.stderr.DEBUG system property to true. org.eclipse.jetty.util.log.stderr.DEBUG system property to true.
(default: false) (default: false)
OPTIONS=[option,option,...] OPTIONS=[option,option,...]
Classpath Options to use. By convention, option names starting with capitals Enable classpath OPTIONS. Each options represents one or more jars
will include associated options (eg Server includes jetty-server, jetty-webapp, to be added to the classpath. The options are defined in
jetty-deploy, etc). An option starting with a lowercase letter includes the start.config file and can be listed with --help or --list-options.
just the direct dependencies of the option (eg jsp includes just jetty-jsp By convention, options starting with a capital letter (eg Server)
module and it's dependencies). are aggregations of other available options. Available OPTIONS:
(default: "default,*")
@OPTIONS@ @OPTIONS@
Configs:
XML Configurations to use. Available Configurations:
By convention, configuration files are kept in $JETTY_HOME/etc.
The known configuration files are:
@CONFIGS@ @CONFIGS@
Defaults:
A start.ini file may be used to specify default arguments to start.jar,
which are used if no command line arguments are provided and override
the defaults in the start.config file. If arguments are provided on the
command line, the special "%start.ini" argument may be used to include
the start.ini arguments and merge any OPTIONS. The current start.ini
arguments are:
@STARTINI@

View File

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Configure Authentication Login Service -->
<!-- Realms may be configured for the entire server here, or -->
<!-- they can be configured for a specific web app in a context -->
<!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
<!-- example). -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>
</Call>
</Configure>