diff options
-rw-r--r-- | VERSION.txt | 1 | ||||
-rw-r--r-- | jetty-deploy/pom.xml | 17 | ||||
-rw-r--r-- | jetty-deploy/src/main/config/etc/jetty-deploy.xml | 52 | ||||
-rw-r--r-- | jetty-deploy/src/test/resources/jetty-deploymgr-contexts.xml | 6 | ||||
-rw-r--r-- | jetty-distribution/pom.xml | 10 | ||||
-rw-r--r-- | jetty-distribution/src/main/resources/start.ini | 53 | ||||
-rw-r--r-- | jetty-plus/src/main/config/etc/jetty-plus.xml | 4 | ||||
-rw-r--r-- | jetty-server/src/main/config/etc/jetty-requestlog.xml | 33 | ||||
-rw-r--r-- | jetty-server/src/main/config/etc/jetty.xml | 113 | ||||
-rw-r--r-- | jetty-start/src/main/java/org/eclipse/jetty/start/Main.java | 175 | ||||
-rw-r--r-- | jetty-start/src/main/resources/org/eclipse/jetty/start/start.config | 8 | ||||
-rw-r--r-- | jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt | 76 | ||||
-rw-r--r-- | test-jetty-webapp/src/main/config/etc/jetty-testrealm.xml | 23 | ||||
-rw-r--r-- | test-jetty-webapp/src/main/config/etc/realm.properties (renamed from jetty-server/src/main/config/etc/realm.properties) | 0 |
14 files changed, 349 insertions, 222 deletions
diff --git a/VERSION.txt b/VERSION.txt index 57181870f5..351ef10153 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -12,6 +12,7 @@ jetty-7.1-SNAPSHOT + 309466 Removed synchronization from StdErrLog + 309765 Added JSP module + 310051 _configurationClasses now defaults to null in WebAppContext + + 310094 Improved start.jar usage and config files + JETTY-903 Stop both caches + JETTY-1200 SSL NIO Endpoint wraps non NIO buffers + JETTY-1202 Use platform default algorithm for SecureRandom diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index a32f1152e9..83491d7dda 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -27,6 +27,23 @@ </executions> </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> <!-- Required for OSGI --> diff --git a/jetty-deploy/src/main/config/etc/jetty-deploy.xml b/jetty-deploy/src/main/config/etc/jetty-deploy.xml new file mode 100644 index 0000000000..f46f72c8ea --- /dev/null +++ b/jetty-deploy/src/main/config/etc/jetty-deploy.xml @@ -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> diff --git a/jetty-deploy/src/test/resources/jetty-deploymgr-contexts.xml b/jetty-deploy/src/test/resources/jetty-deploymgr-contexts.xml index 841944926d..07cf8d2889 100644 --- a/jetty-deploy/src/test/resources/jetty-deploymgr-contexts.xml +++ b/jetty-deploy/src/test/resources/jetty-deploymgr-contexts.xml @@ -15,7 +15,7 @@ <Array type="org.eclipse.jetty.deploy.AppProvider"> <Item> <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="configurationManager"> <New class="org.eclipse.jetty.deploy.FileConfigurationManager"> @@ -28,9 +28,9 @@ </Item> <Item> <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="contextXmlDir"><Property name="jetty.home" />/contexts</Set> + <Set name="contextXmlDir"><SystemProperty name="jetty.home" />/contexts</Set> </New> </Item> </Array> diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 8154e4eb2d..04e594cbf9 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -145,6 +145,16 @@ </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> + <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-plus</artifactId> <version>${project.version}</version> <classifier>config</classifier> diff --git a/jetty-distribution/src/main/resources/start.ini b/jetty-distribution/src/main/resources/start.ini index 28c64573b2..3663603cfd 100644 --- a/jetty-distribution/src/main/resources/start.ini +++ b/jetty-distribution/src/main/resources/start.ini @@ -1,10 +1,13 @@ #=========================================================== # Jetty start.jar arguments -#----------------------------------------------------------- # Each line of this file is prepended to the command line # arguments # of a call to: # java -jar start.jar [arg...] -# +#=========================================================== + + + +#=========================================================== # If the arguements in this file include JVM arguments # (eg -Xmx512m) or JVM System properties (eg com.sun.???), # then these will not take affect unless the --exec @@ -12,20 +15,46 @@ # is executed like: # eval $(java -jar start.jar --dry-run) # -#=========================================================== +# Below are some recommended options for Sun's JRE +#----------------------------------------------------------- +# --exec +# -Dcom.sun.management.jmxremote +# -Xmx2000m +# -Xmn512m +# -verbose:gc +# -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 +#----------------------------------------------------------- + #=========================================================== -# The following is an example of the ini args to run the -# server with a heap size, JMX remote enabled, JMX mbeans -# and ssl +# Configuration files. +# For a full list of available configuration files do +# java -jar start.jar --help #----------------------------------------------------------- -# --exec -# -Xmx512m -# -Dcom.sun.management.jmxremote -# OPTIONS=Server,jmx,resources -# etc/jetty-jmx.xml -# etc/jetty.xml +#etc/jetty-jmx.xml +etc/jetty.xml # etc/jetty-ssl.xml +# etc/jetty-requestlog.xml +etc/jetty-deploy.xml +etc/jetty-testrealm.xml #=========================================================== diff --git a/jetty-plus/src/main/config/etc/jetty-plus.xml b/jetty-plus/src/main/config/etc/jetty-plus.xml index 027a1dc7b4..06bbcd2fcf 100644 --- a/jetty-plus/src/main/config/etc/jetty-plus.xml +++ b/jetty-plus/src/main/config/etc/jetty-plus.xml @@ -63,10 +63,10 @@ <Call name="addAppProvider"> <Arg> <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="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="extractWars">true</Set> <Set name="configurationClasses"><Ref id="plusConfig"/></Set> diff --git a/jetty-server/src/main/config/etc/jetty-requestlog.xml b/jetty-server/src/main/config/etc/jetty-requestlog.xml new file mode 100644 index 0000000000..4ab4f67705 --- /dev/null +++ b/jetty-server/src/main/config/etc/jetty-requestlog.xml @@ -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> diff --git a/jetty-server/src/main/config/etc/jetty.xml b/jetty-server/src/main/config/etc/jetty.xml index 323d610656..fcfd31857c 100644 --- a/jetty-server/src/main/config/etc/jetty.xml +++ b/jetty-server/src/main/config/etc/jetty.xml @@ -5,8 +5,13 @@ <!-- Configure the Jetty Server --> <!-- --> <!-- 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> </Set> - - <!-- =========================================================== --> <!-- Set connectors --> <!-- =========================================================== --> @@ -44,26 +47,6 @@ </Arg> </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 --> <!-- =========================================================== --> @@ -77,96 +60,12 @@ <Item> <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/> </Item> - <Item> - <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/> - </Item> </Array> </Set> </New> </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 --> <!-- =========================================================== --> <Set name="stopAtShutdown">true</Set> diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 435b008417..f150f2cdab 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -63,7 +63,7 @@ public class Main private boolean _fromDaemon = false; private final Config _config = new Config(); private Set<String> _sysProps = new HashSet<String>(); - private List<String> _xArgs = new ArrayList<String>(); + private List<String> _jvmArgs = new ArrayList<String>(); private String _jettyHome; @@ -86,16 +86,35 @@ public class Main { List<String> arguments = new ArrayList<String>(); - 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 + // 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) + + // 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 List<String> xmls = new ArrayList<String>(); + // Process the arguments for (String arg : arguments) { - if ("--help".equals(arg)) + + if ("--help".equals(arg) || "-?".equals(arg)) { _showUsage = true; continue; @@ -148,12 +167,6 @@ public class Main _secure = true; continue; } - - if (arg.startsWith("-X")) - { - _xArgs.add(arg); - continue; - } if (arg.startsWith("-D")) { @@ -173,15 +186,28 @@ public class Main continue; } + if (arg.startsWith("-")) + { + _jvmArgs.add(arg); + continue; + } + // Is this a Property? - else if (arg.indexOf('=') >= 0) + if (arg.indexOf('=') >= 0) { String[] assign = arg.split("=",2); switch(assign.length) { case 2: - this._config.setProperty(assign[0],assign[1]); + 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]); break; case 1: this._config.setProperty(assign[0],null); @@ -189,21 +215,13 @@ public class Main default: break; } + continue; } // Anything else is considered an XML file. 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); } @@ -278,61 +296,81 @@ public class Main while ((line = buf.readLine()) != null) { - if (line.startsWith("@OPTIONS@")) + if (line.endsWith("@") && line.indexOf('@')!=line.lastIndexOf('@')) { - List<String> sortedOptions = new ArrayList<String>(); - sortedOptions.addAll(_config.getSectionIds()); - Collections.sort(sortedOptions); - - System.err.println(" Available OPTIONS: "); + String indent=line.substring(0,line.indexOf("@")); + String info=line.substring(line.indexOf('@'),line.lastIndexOf('@')); - for (String option : sortedOptions) + if (info.equals("@OPTIONS")) { - System.err.println(" [" + option + "]"); - } - } - 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; - } + List<String> sortedOptions = new ArrayList<String>(); + sortedOptions.addAll(_config.getSectionIds()); + Collections.sort(sortedOptions); - if (!etc.isDirectory()) - { - System.err.println(" Unable list dir " + etc); - continue; + for (String option : sortedOptions) + { + if ("*".equals(option) || option.trim().length()==0) + continue; + System.out.print(indent); + System.out.println(option); + } } - - File configs[] = etc.listFiles(new FileFilter() + else if (info.equals("@CONFIGS")) { - public boolean accept(File path) + File etc = new File(System.getProperty("jetty.home","."),"etc"); + if (!etc.exists() || !etc.isDirectory()) { - if (!path.isFile()) + System.out.print(indent); + System.out.println("Unable to find/list " + etc); + continue; + } + + File configs[] = etc.listFiles(new FileFilter() + { + public boolean accept(File path) { - return false; - } + if (!path.isFile()) + { + return false; + } - String name = path.getName().toLowerCase(); - return (name.startsWith("jetty") && name.endsWith(".xml")); - } - }); + String name = path.getName().toLowerCase(); + return (name.startsWith("jetty") && name.endsWith(".xml")); + } + }); - List<File> configFiles = new ArrayList<File>(); - configFiles.addAll(Arrays.asList(configs)); - Collections.sort(configFiles); + List<File> configFiles = new ArrayList<File>(); + configFiles.addAll(Arrays.asList(configs)); + Collections.sort(configFiles); - for (File configFile : configFiles) + for (File configFile : configFiles) + { + System.out.print(indent); + System.out.print("etc/"); + System.out.println(configFile.getName()); + } + } + else if (info.equals("@STARTINI")) { - System.err.println(" etc/" + configFile.getName()); + List<String> ini = loadStartIni(); + if (ini!=null && ini.size()>0) + { + for (String a : ini) + { + System.out.print(indent); + System.out.println(a); + } + } + else + { + System.out.print(indent); + System.out.println("none"); + } } } else { - System.err.println(line); + System.out.println(line); } } } @@ -380,7 +418,8 @@ public class Main 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; } } @@ -516,7 +555,7 @@ public class Main 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"); // Set current context class loader to what is selected. @@ -609,18 +648,18 @@ public class Main { StringBuilder cmd = new StringBuilder(); cmd.append(findJavaBin()); - for (String x:_xArgs) + for (String x:_jvmArgs) cmd.append(' ').append(x); cmd.append(" -Djetty.home=").append(_jettyHome); for (String p:_sysProps) { - cmd.append(" -D").append(p); + cmd.append(" -D").append(p); String v=System.getProperty(p); - if (v!=null) + if (v!=null && v.length()>0) cmd.append('=').append(v); } - cmd.append(" -cp ").append(classpath.toString()); - cmd.append(' ').append(_config.getMainClassname()); + cmd.append(" -cp ").append(classpath.toString()); + cmd.append(" ").append(_config.getMainClassname()); for (String xml : xmls) { cmd.append(' ').append(xml); diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/start.config b/jetty-start/src/main/resources/org/eclipse/jetty/start/start.config index 0c1dc119db..2761897e7a 100644 --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/start.config +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/start.config @@ -139,13 +139,17 @@ $(jetty.home)/lib/setuid/** $(jetty.home)/lib/jetty-policy-$(version).jar ! available org.eclipse.jetty.policy.JettyPolicy $(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-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] $(jetty.home)/lib/jetty-websocket-$(version).jar ! available org.eclipse.jetty.websocket.WebSocket - + + # Add ext if it exists [Server,All,default,ext] $(jetty.home)/lib/ext/** diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt index 18a0e3b495..7383c0112a 100644 --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt @@ -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 a classloader built from that classpath. By default the start.jar mechanism is configured to start the jetty server, but it can be configured to start any java main class. -Common Options: +Command Line Options: --help This help / usage information. - --version Print the version information for Jetty, then exit. - --stop Stop the running Jetty instance. - -Advanced Options: - - --list-options List available options, then exit. - (see OPTION property in section below) + + --version Print the version information for Jetty and + dependent jars, then exit. + --list-options List the details of each classpath OPTION + --dry-run Print the command line that the start.jar generates, then exit. This may be used to generate command lines 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 a sub processes. This can be used when start.ini contains -X or -D arguments, but creates an extra JVM instance. + --secure Enable Security: * JVM Security Manager * Security Policies * Secure Logging * Audit Logging - - If the file start.ini exists in the working directory, then it's each line - of it's contents is prepended to the as an argument to the command line. + + --stop Stop the running Jetty instance. + System Properties: These are set with a command line like "java -Dname=value ..." and are accessible via the java.lang.System#getProperty(String) API. Some key system properties are: + org.eclipse.jetty.util.log.class=[class] A Low Level Jetty Logger Implementation to use (default: org.eclipse.jetty.util.log.Slf4jLog) + org.eclipse.jetty.util.log.DEBUG=[boolean] Debug logging for the stderr and javautil Loggers. Slf4j and other loggers must be separately configured for debug. (default: false) + org.eclipse.jetty.util.log.IGNORED=[boolean] Ignored exceptions are logged, independent of DEBUG settings (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" and only affect the start mechanism. Some of these are defined in the default start.config and will not be available if another configuration @@ -61,29 +63,47 @@ Start Properties: path=[directory] An additional class path element to add to the started class path. Typically this is used to add directories of classes and/or resources + lib=[directory] An additional library directory to add to the started class path. This must be a (deep) directory of jars + STOP.PORT=[number] The port to use to stop the running Jetty server. Required along with STOP.KEY if you want to use the --stop option above. + STOP.KEY=[alphanumeric] The passphrase defined to stop the server. Requried along with STOP.PORT if you want to use the --stop option above. + DEBUG=true Enable debug on the start mechanism and sets the org.eclipse.jetty.util.log.stderr.DEBUG system property to true. (default: false) - OPTIONS=[option,option,...] - Classpath Options to use. By convention, option names starting with capitals - will include associated options (eg Server includes jetty-server, jetty-webapp, - jetty-deploy, etc). An option starting with a lowercase letter includes - just the direct dependencies of the option (eg jsp includes just jetty-jsp - module and it's dependencies). - (default: "default,*") -@OPTIONS@ + OPTIONS=[option,option,...] + Enable classpath OPTIONS. Each options represents one or more jars + to be added to the classpath. The options are defined in + the start.config file and can be listed with --help or --list-options. + By convention, options starting with a capital letter (eg Server) + are aggregations of other available options. Available OPTIONS: + + @OPTIONS@ + + +Available Configurations: + By convention, configuration files are kept in $JETTY_HOME/etc. + The known configuration files are: + + @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: -Configs: - XML Configurations to use. -@CONFIGS@ + @STARTINI@ diff --git a/test-jetty-webapp/src/main/config/etc/jetty-testrealm.xml b/test-jetty-webapp/src/main/config/etc/jetty-testrealm.xml new file mode 100644 index 0000000000..c0d39fe497 --- /dev/null +++ b/test-jetty-webapp/src/main/config/etc/jetty-testrealm.xml @@ -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> diff --git a/jetty-server/src/main/config/etc/realm.properties b/test-jetty-webapp/src/main/config/etc/realm.properties index cbf905de9f..cbf905de9f 100644 --- a/jetty-server/src/main/config/etc/realm.properties +++ b/test-jetty-webapp/src/main/config/etc/realm.properties |