diff --git a/jetty-annotations/src/main/config/modules/annotations.mod b/jetty-annotations/src/main/config/modules/annotations.mod index 3470bf75c79..65e4654127d 100644 --- a/jetty-annotations/src/main/config/modules/annotations.mod +++ b/jetty-annotations/src/main/config/modules/annotations.mod @@ -2,13 +2,16 @@ # Jetty Annotation Scanning Module # +[depend] # Annotations needs plus, and jndi features -DEPEND=plus +plus +[lib] # Annotations needs jetty annotation jars -LIB=lib/jetty-annotations-${jetty.version}.jar +lib/jetty-annotations-${jetty.version}.jar # Need annotation processing jars too -LIB=lib/annotations/*.jar +lib/annotations/*.jar +[xml] # Enable annotation scanning webapp configurations etc/jetty-annotations.xml diff --git a/jetty-client/src/main/config/modules/client.mod b/jetty-client/src/main/config/modules/client.mod index f434cdc0870..6788eacf79c 100644 --- a/jetty-client/src/main/config/modules/client.mod +++ b/jetty-client/src/main/config/modules/client.mod @@ -2,5 +2,6 @@ # Client Feature # +[lib] # Client jars -LIB=lib/jetty-client-${jetty.version}.jar +lib/jetty-client-${jetty.version}.jar diff --git a/jetty-deploy/src/main/config/modules/deploy.mod b/jetty-deploy/src/main/config/modules/deploy.mod index 47fc62c1774..94c0e403168 100644 --- a/jetty-deploy/src/main/config/modules/deploy.mod +++ b/jetty-deploy/src/main/config/modules/deploy.mod @@ -2,10 +2,13 @@ # Deploy Feature # -DEPEND=webapp +[depend] +webapp +[lib] # Deploy jars -LIB=lib/jetty-deploy-${jetty.version}.jar +lib/jetty-deploy-${jetty.version}.jar +[xml] # Deploy configuration etc/jetty-deploy.xml diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index e3b23a76374..0f25efd50a3 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -10,7 +10,7 @@ http://www.eclipse.org/jetty pom - target/distribution + ${basedir}/target/distribution 1.0.1 @@ -101,7 +101,7 @@ war true ** - ${assembly-directory}/demo/webapps + ${assembly-directory}/demo-base/webapps test.war @@ -111,7 +111,7 @@ war true ** - ${assembly-directory}/demo/webapps + ${assembly-directory}/demo-base/webapps test-jaas.war @@ -121,7 +121,7 @@ war true ** - ${assembly-directory}/demo/webapps + ${assembly-directory}/demo-base/webapps test-jndi.war @@ -131,7 +131,7 @@ war true ** - ${assembly-directory}/demo/webapps + ${assembly-directory}/demo-base/webapps test-spec.war @@ -141,7 +141,7 @@ war true ** - ${assembly-directory}/demo/webapps + ${assembly-directory}/demo-base/webapps xref-proxy.war @@ -151,7 +151,7 @@ war true ** - ${assembly-directory}/demo/webapps + ${assembly-directory}/demo-base/webapps async-rest.war @@ -466,20 +466,19 @@ exec-maven-plugin - package + process-classes - exec + java - java - ${assembly-directory} + org.eclipse.jetty.start.Main - -jar - start.jar - --module-start-ini=server,ext,resources,jsp,annotations - --module-ini=http,demo + --debug + jetty.home=${assembly-directory} + jetty.base=${assembly-directory} + --module-start-ini=server,deploy,http,websocket,jsp,ext,resources diff --git a/jetty-distribution/src/main/resources/demo/webapps/README.TXT b/jetty-distribution/src/main/resources/demo-base/webapps/README.TXT similarity index 100% rename from jetty-distribution/src/main/resources/demo/webapps/README.TXT rename to jetty-distribution/src/main/resources/demo-base/webapps/README.TXT diff --git a/jetty-distribution/src/main/resources/demo/webapps/ROOT/images/jetty-header.jpg b/jetty-distribution/src/main/resources/demo-base/webapps/ROOT/images/jetty-header.jpg similarity index 100% rename from jetty-distribution/src/main/resources/demo/webapps/ROOT/images/jetty-header.jpg rename to jetty-distribution/src/main/resources/demo-base/webapps/ROOT/images/jetty-header.jpg diff --git a/jetty-distribution/src/main/resources/demo/webapps/ROOT/images/webtide_logo.jpg b/jetty-distribution/src/main/resources/demo-base/webapps/ROOT/images/webtide_logo.jpg similarity index 100% rename from jetty-distribution/src/main/resources/demo/webapps/ROOT/images/webtide_logo.jpg rename to jetty-distribution/src/main/resources/demo-base/webapps/ROOT/images/webtide_logo.jpg diff --git a/jetty-distribution/src/main/resources/demo/webapps/ROOT/index.html b/jetty-distribution/src/main/resources/demo-base/webapps/ROOT/index.html similarity index 100% rename from jetty-distribution/src/main/resources/demo/webapps/ROOT/index.html rename to jetty-distribution/src/main/resources/demo-base/webapps/ROOT/index.html diff --git a/jetty-distribution/src/main/resources/demo/webapps/ROOT/jetty.css b/jetty-distribution/src/main/resources/demo-base/webapps/ROOT/jetty.css similarity index 100% rename from jetty-distribution/src/main/resources/demo/webapps/ROOT/jetty.css rename to jetty-distribution/src/main/resources/demo-base/webapps/ROOT/jetty.css diff --git a/jetty-distribution/src/main/resources/demo/webapps/example-moved.xml b/jetty-distribution/src/main/resources/demo-base/webapps/example-moved.xml similarity index 100% rename from jetty-distribution/src/main/resources/demo/webapps/example-moved.xml rename to jetty-distribution/src/main/resources/demo-base/webapps/example-moved.xml diff --git a/jetty-distribution/src/main/resources/demo/webapps/javadoc.xml b/jetty-distribution/src/main/resources/demo-base/webapps/javadoc.xml similarity index 100% rename from jetty-distribution/src/main/resources/demo/webapps/javadoc.xml rename to jetty-distribution/src/main/resources/demo-base/webapps/javadoc.xml diff --git a/jetty-distribution/src/main/resources/modules/setuid.mod b/jetty-distribution/src/main/resources/modules/setuid.mod index f939eb17a90..d6b5d1e1880 100644 --- a/jetty-distribution/src/main/resources/modules/setuid.mod +++ b/jetty-distribution/src/main/resources/modules/setuid.mod @@ -1,9 +1,14 @@ -DEPEND=server -LIB=jetty-setuid-java-1.0.1.jar +[depend] +server +[lib] +jetty-setuid-java-1.0.1.jar + +[xml] etc/jetty-setuid.xml -INI=# jetty.startServerAsPrivileged=false -INI=# jetty.username=jetty -INI=# jetty.groupname=jetty -INI=# jetty.umask=002 +[ini] +# jetty.startServerAsPrivileged=false +# jetty.username=jetty +# jetty.groupname=jetty +# jetty.umask=002 diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java index c6be5ff8e41..a5757579cc4 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/SelectorManager.java @@ -362,56 +362,41 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa */ public void submit(Runnable change) { - if (isSelectorThread()) - { - if (_state.get() == State.PROCESS) - { - // 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); - LOG.debug("Queued change {}", change); + // This method may be called from the selector thread, and therefore + // we could directly run the change without queueing, but this may + // lead to stack overflows on a busy server, so we always offer the + // change to the queue and process the state. - out: while (true) + _changes.offer(change); + LOG.debug("Queued change {}", change); + + out: while (true) + { + switch (_state.get()) { - switch (_state.get()) - { - case SELECT: - // Avoid multiple wakeup() calls if we the CAS fails - if (!_state.compareAndSet(State.SELECT, State.WAKEUP)) - continue; - wakeup(); - break out; - case CHANGES: - // Tell the selector thread that we have more changes. - // If we fail to CAS, we possibly need to wakeup(), so loop. - if (_state.compareAndSet(State.CHANGES, State.MORE_CHANGES)) - break out; + case SELECT: + // Avoid multiple wakeup() calls if we the CAS fails + if (!_state.compareAndSet(State.SELECT, State.WAKEUP)) continue; - case WAKEUP: - // Do nothing, we have already a wakeup scheduled + wakeup(); + break out; + case CHANGES: + // Tell the selector thread that we have more changes. + // If we fail to CAS, we possibly need to wakeup(), so loop. + if (_state.compareAndSet(State.CHANGES, State.MORE_CHANGES)) break out; - case MORE_CHANGES: - // Do nothing, we already notified the selector thread of more changes - break out; - case PROCESS: - // Do nothing, the changes will be run after the processing - break out; - default: - throw new IllegalStateException(); - } + continue; + case WAKEUP: + // Do nothing, we have already a wakeup scheduled + break out; + case MORE_CHANGES: + // Do nothing, we already notified the selector thread of more changes + break out; + case PROCESS: + // Do nothing, the changes will be run after the processing + break out; + default: + throw new IllegalStateException(); } } } diff --git a/jetty-jaas/src/main/config/modules/jaas.mod b/jetty-jaas/src/main/config/modules/jaas.mod index 8fdba5ada4a..521d151f3c1 100644 --- a/jetty-jaas/src/main/config/modules/jaas.mod +++ b/jetty-jaas/src/main/config/modules/jaas.mod @@ -2,12 +2,16 @@ # JAAS Feature # -DEPEND=server +[depend] +server +[lib] # JAAS jars -LIB=lib/jetty-jaas-${jetty.version}.jar +lib/jetty-jaas-${jetty.version}.jar +[xml] # JAAS configuration etc/jetty-jaas.xml -INI=jaas.login.conf=etc/login.conf \ No newline at end of file +[ini] +jaas.login.conf=etc/login.conf \ No newline at end of file diff --git a/jetty-jmx/src/main/config/modules/jmx.mod b/jetty-jmx/src/main/config/modules/jmx.mod index 11224a299c9..37c0cc3930a 100644 --- a/jetty-jmx/src/main/config/modules/jmx.mod +++ b/jetty-jmx/src/main/config/modules/jmx.mod @@ -2,12 +2,15 @@ # JMX Feature # +[lib] # JMX jars (as defined in start.config) -LIB=lib/jetty-jmx-${jetty.version}.jar +lib/jetty-jmx-${jetty.version}.jar +[xml] # JMX configuration etc/jetty-jmx.xml -INI=# jetty.jmxrmihost=localhost -INI=# jetty.jmxrmiport=1099 -INI=# -Dcom.sun.management.jmxremote \ No newline at end of file +[ini] +# jetty.jmxrmihost=localhost +# jetty.jmxrmiport=1099 +# -Dcom.sun.management.jmxremote \ No newline at end of file diff --git a/jetty-jndi/src/main/config/modules/jndi.mod b/jetty-jndi/src/main/config/modules/jndi.mod index cfdcc526142..33c077ce684 100644 --- a/jetty-jndi/src/main/config/modules/jndi.mod +++ b/jetty-jndi/src/main/config/modules/jndi.mod @@ -2,8 +2,10 @@ # JNDI Support # -DEPEND=server +[depend] +server -LIB=lib/jetty-jndi-${jetty.version}.jar -LIB=lib/jndi/*.jar +[lib] +lib/jetty-jndi-${jetty.version}.jar +lib/jndi/*.jar diff --git a/jetty-jsp/src/main/config/modules/jsp.mod b/jetty-jsp/src/main/config/modules/jsp.mod index d24dddf44d5..f85530d3c8a 100644 --- a/jetty-jsp/src/main/config/modules/jsp.mod +++ b/jetty-jsp/src/main/config/modules/jsp.mod @@ -2,7 +2,9 @@ # Jetty Servlet Module # -DEPEND=servlet +[depend] +servlet -LIB=lib/jsp/*.jar +[lib] +lib/jsp/*.jar diff --git a/jetty-monitor/src/main/config/modules/monitor.mod b/jetty-monitor/src/main/config/modules/monitor.mod index 249ccef15d1..67f006d0c4c 100644 --- a/jetty-monitor/src/main/config/modules/monitor.mod +++ b/jetty-monitor/src/main/config/modules/monitor.mod @@ -2,9 +2,12 @@ # Jetty Monitor module # -DEPEND=server -DEPEND=client +[depend] +server +client -LIB=lib/jetty-monitor-${jetty.version}.jar +[lib] +lib/jetty-monitor-${jetty.version}.jar +[xml] etc/jetty-monitor.xml \ No newline at end of file diff --git a/jetty-nosql/src/main/config/modules/nosql.mod b/jetty-nosql/src/main/config/modules/nosql.mod index 3d8b099ed0e..a4189c945b9 100644 --- a/jetty-nosql/src/main/config/modules/nosql.mod +++ b/jetty-nosql/src/main/config/modules/nosql.mod @@ -2,6 +2,8 @@ # Jetty Nosql module # -DEPEND=webapp +[depend] +webapp -LIB=lib/jetty-nosql-${jetty.version}.jar \ No newline at end of file +[lib] +lib/jetty-nosql-${jetty.version}.jar \ No newline at end of file diff --git a/jetty-overlay-deployer/src/main/config/modules/overlay.mod b/jetty-overlay-deployer/src/main/config/modules/overlay.mod index a006476a60d..5e73f6bc29a 100644 --- a/jetty-overlay-deployer/src/main/config/modules/overlay.mod +++ b/jetty-overlay-deployer/src/main/config/modules/overlay.mod @@ -2,9 +2,12 @@ # 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 etc/jetty-overlay.xml diff --git a/jetty-plus/src/main/config/modules/plus.mod b/jetty-plus/src/main/config/modules/plus.mod index caa799376a6..b781f00bf2f 100644 --- a/jetty-plus/src/main/config/modules/plus.mod +++ b/jetty-plus/src/main/config/modules/plus.mod @@ -2,11 +2,14 @@ # Jetty Proxy module # -DEPEND=server -DEPEND=security -DEPEND=jndi +[depend] +server +security +jndi -LIB=lib/jetty-plus-${jetty.version}.jar +[lib] +lib/jetty-plus-${jetty.version}.jar +[xml] # Plus requires configuration etc/jetty-plus.xml diff --git a/jetty-proxy/src/main/config/modules/proxy.mod b/jetty-proxy/src/main/config/modules/proxy.mod index 5ab6e70a880..7873329afaa 100644 --- a/jetty-proxy/src/main/config/modules/proxy.mod +++ b/jetty-proxy/src/main/config/modules/proxy.mod @@ -2,10 +2,13 @@ # Jetty Proxy module # -DEPEND=server -DEPEND=client +[depend] +server +client -LIB=lib/jetty-proxy-${jetty.version}.jar +[lib] +lib/jetty-proxy-${jetty.version}.jar +[xml] # Proxy requires configuration etc/jetty-proxy.xml diff --git a/jetty-rewrite/src/main/config/modules/rewrite.mod b/jetty-rewrite/src/main/config/modules/rewrite.mod index d5ccf960410..85fe5f090d1 100644 --- a/jetty-rewrite/src/main/config/modules/rewrite.mod +++ b/jetty-rewrite/src/main/config/modules/rewrite.mod @@ -2,9 +2,12 @@ # 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 etc/jetty-rewrite.xml diff --git a/jetty-security/src/main/config/modules/security.mod b/jetty-security/src/main/config/modules/security.mod index 5a3c4a368a6..ba3163275f5 100644 --- a/jetty-security/src/main/config/modules/security.mod +++ b/jetty-security/src/main/config/modules/security.mod @@ -2,6 +2,8 @@ # Jetty Security Module # -DEPEND=server +[depend] +server -LIB=lib/jetty-security-${jetty.version}.jar +[lib] +lib/jetty-security-${jetty.version}.jar diff --git a/jetty-server/src/main/config/modules/debug.mod b/jetty-server/src/main/config/modules/debug.mod index 8cdf5b94ab6..f740ea2c762 100644 --- a/jetty-server/src/main/config/modules/debug.mod +++ b/jetty-server/src/main/config/modules/debug.mod @@ -2,6 +2,8 @@ # Debug module # -DEPEND=server +[depend] +server +[xml] etc/jetty-debug.xml diff --git a/jetty-server/src/main/config/modules/ext.mod b/jetty-server/src/main/config/modules/ext.mod index 1e09cd62d8a..e8b9021ffd7 100644 --- a/jetty-server/src/main/config/modules/ext.mod +++ b/jetty-server/src/main/config/modules/ext.mod @@ -1,2 +1,2 @@ - -LIB=lib/ext/* \ No newline at end of file +[lib] +lib/ext/* \ No newline at end of file diff --git a/jetty-server/src/main/config/modules/http.mod b/jetty-server/src/main/config/modules/http.mod index e1feadcaab8..e5e923a6c35 100644 --- a/jetty-server/src/main/config/modules/http.mod +++ b/jetty-server/src/main/config/modules/http.mod @@ -2,9 +2,12 @@ # Jetty HTTP Connector # -DEPEND=server +[depend] +server +[xml] etc/jetty-http.xml -INI=jetty.port=8080 -INI=http.timeout=30000 \ No newline at end of file +[ini] +jetty.port=8080 +http.timeout=30000 \ No newline at end of file diff --git a/jetty-server/src/main/config/modules/https.mod b/jetty-server/src/main/config/modules/https.mod index 655630e0e12..609b26a9d98 100644 --- a/jetty-server/src/main/config/modules/https.mod +++ b/jetty-server/src/main/config/modules/https.mod @@ -2,9 +2,12 @@ # Jetty HTTPS Connector # -DEPEND=ssl +[depend] +ssl +[xml] etc/jetty-https.xml -INI=https.port=8443 -INI=https.timeout=30000 \ No newline at end of file +[ini] +https.port=8443 +https.timeout=30000 \ No newline at end of file diff --git a/jetty-server/src/main/config/modules/ipaccess.mod b/jetty-server/src/main/config/modules/ipaccess.mod index f99f26ec3e3..956ea0f2e3a 100644 --- a/jetty-server/src/main/config/modules/ipaccess.mod +++ b/jetty-server/src/main/config/modules/ipaccess.mod @@ -2,6 +2,8 @@ # IPAccess module # -DEPEND=server +[depend] +server +[xml] etc/jetty-ipaccess.xml diff --git a/jetty-server/src/main/config/modules/jvm.mod b/jetty-server/src/main/config/modules/jvm.mod index cfec7839744..5fc8680fe36 100644 --- a/jetty-server/src/main/config/modules/jvm.mod +++ b/jetty-server/src/main/config/modules/jvm.mod @@ -1,24 +1,24 @@ - -INI=#=========================================================== -INI=# Configure JVM arguments. -INI=# If JVM args are include in an ini file then --exec is needed -INI=# to start a new JVM from start.jar with the extra args. -INI=# If you wish to avoid an extra JVM running, place JVM args -INI=# on the normal command line and do not use --exec -INI=#----------------------------------------------------------- -INI=# --exec -INI=# -Xmx2000m -INI=# -Xmn512m -INI=# -XX:+UseConcMarkSweepGC -INI=# -XX:ParallelCMSThreads=2 -INI=# -XX:+CMSClassUnloadingEnabled -INI=# -XX:+UseCMSCompactAtFullCollection -INI=# -XX:CMSInitiatingOccupancyFraction=80 -INI=# -verbose:gc -INI=# -XX:+PrintGCDateStamps -INI=# -XX:+PrintGCTimeStamps -INI=# -XX:+PrintGCDetails -INI=# -XX:+PrintTenuringDistribution -INI=# -XX:+PrintCommandLineFlags -INI=# -XX:+DisableExplicitGC -INI=# -Dorg.apache.jasper.compiler.disablejsr199=true \ No newline at end of file +[ini] +#=========================================================== +# Configure JVM arguments. +# If JVM args are include in an ini file then --exec is needed +# to start a new JVM from start.jar with the extra args. +# If you wish to avoid an extra JVM running, place JVM args +# on the normal command line and do not use --exec +#----------------------------------------------------------- +# --exec +# -Xmx2000m +# -Xmn512m +# -XX:+UseConcMarkSweepGC +# -XX:ParallelCMSThreads=2 +# -XX:+CMSClassUnloadingEnabled +# -XX:+UseCMSCompactAtFullCollection +# -XX:CMSInitiatingOccupancyFraction=80 +# -verbose:gc +# -XX:+PrintGCDateStamps +# -XX:+PrintGCTimeStamps +# -XX:+PrintGCDetails +# -XX:+PrintTenuringDistribution +# -XX:+PrintCommandLineFlags +# -XX:+DisableExplicitGC +# -Dorg.apache.jasper.compiler.disablejsr199=true \ No newline at end of file diff --git a/jetty-server/src/main/config/modules/lowresources.mod b/jetty-server/src/main/config/modules/lowresources.mod index 101f638f406..bcb781fb7b7 100644 --- a/jetty-server/src/main/config/modules/lowresources.mod +++ b/jetty-server/src/main/config/modules/lowresources.mod @@ -2,13 +2,16 @@ # Low Resources module # -DEPEND=server +[depend] +server +[xml] etc/jetty-lowresources.xml -INI=# lowresources.period=1050 -INI=# lowresources.lowResourcesIdleTimeout=200 -INI=# lowresources.monitorThreads=true -INI=# lowresources.maxConnections=0 -INI=# lowresources.maxMemory=0 -INI=# lowresources.maxLowResourcesTime=5000 \ No newline at end of file +[ini] +# lowresources.period=1050 +# lowresources.lowResourcesIdleTimeout=200 +# lowresources.monitorThreads=true +# lowresources.maxConnections=0 +# lowresources.maxMemory=0 +# lowresources.maxLowResourcesTime=5000 \ No newline at end of file diff --git a/jetty-server/src/main/config/modules/requestlog.mod b/jetty-server/src/main/config/modules/requestlog.mod index 03c726c4ae2..9d17958a46e 100644 --- a/jetty-server/src/main/config/modules/requestlog.mod +++ b/jetty-server/src/main/config/modules/requestlog.mod @@ -2,10 +2,13 @@ # Request Log module # -DEPEND=server +[depend] +server +[xml] etc/jetty-requestlog.xml -INI=# requestlog.retain=90 -INI=# requestlog.append=true -INI=# requestlog.extended=true +[ini] +# requestlog.retain=90 +# requestlog.append=true +# requestlog.extended=true diff --git a/jetty-server/src/main/config/modules/resources.mod b/jetty-server/src/main/config/modules/resources.mod index 5782922a2e1..2064da718b8 100644 --- a/jetty-server/src/main/config/modules/resources.mod +++ b/jetty-server/src/main/config/modules/resources.mod @@ -1,2 +1,2 @@ - -LIB=resources \ No newline at end of file +[lib] +resources \ No newline at end of file diff --git a/jetty-server/src/main/config/modules/server.mod b/jetty-server/src/main/config/modules/server.mod index 3eada328e6a..dcd608852e8 100644 --- a/jetty-server/src/main/config/modules/server.mod +++ b/jetty-server/src/main/config/modules/server.mod @@ -2,29 +2,32 @@ # Base server # -OPTIONAL=jvm -OPTIONAL=jmx -OPTIONAL=ext -OPTIONAL=resources - -LIB=lib/servlet-api-3.1.jar -LIB=lib/jetty-schemas-3.1.jar -LIB=lib/jetty-http-${jetty.version}.jar -LIB=lib/jetty-continuation-${jetty.version}.jar -LIB=lib/jetty-server-${jetty.version}.jar -LIB=lib/jetty-xml-${jetty.version}.jar -LIB=lib/jetty-util-${jetty.version}.jar -LIB=lib/jetty-io-${jetty.version}.jar +[optional] +jvm +jmx +ext +resources +[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 etc/jetty.xml -INI=threads.min=10 -INI=threads.max=200 -INI=threads.timeout=60000 -INI=#jetty.host=myhost.com -INI=jetty.dump.start=false -INI=jetty.dump.stop=false +[ini] +threads.min=10 +threads.max=200 +threads.timeout=60000 +#jetty.host=myhost.com +jetty.dump.start=false +jetty.dump.stop=false diff --git a/jetty-server/src/main/config/modules/ssl.mod b/jetty-server/src/main/config/modules/ssl.mod index 96d6f81aa41..be4a4aebe3c 100644 --- a/jetty-server/src/main/config/modules/ssl.mod +++ b/jetty-server/src/main/config/modules/ssl.mod @@ -1,13 +1,19 @@ # SSL Keystore module -DEPEND=server -etc/jetty-ssl.xml -DOWNLOAD=http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore:etc/keystore +[depend] +server -INI=jetty.keystore=etc/keystore -INI=jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 -INI=jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g -INI=jetty.truststore=etc/keystore -INI=jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 -INI=jetty.secure.port=8443 +[xml] +etc/jetty-ssl.xml + +[download] +http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/plain/jetty-server/src/main/config/etc/keystore:etc/keystore + +[ini] +jetty.keystore=etc/keystore +jetty.keystore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 +jetty.keymanager.password=OBF:1u2u1wml1z7s1z7a1wnl1u2g +jetty.truststore=etc/keystore +jetty.truststore.password=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 +jetty.secure.port=8443 diff --git a/jetty-server/src/main/config/modules/stats.mod b/jetty-server/src/main/config/modules/stats.mod index cd56d5b4d7b..0922469cdfb 100644 --- a/jetty-server/src/main/config/modules/stats.mod +++ b/jetty-server/src/main/config/modules/stats.mod @@ -2,6 +2,8 @@ # Stats module # -DEPEND=server +[depend] +server +[xml] etc/jetty-stats.xml diff --git a/jetty-server/src/main/config/modules/xinetd.mod b/jetty-server/src/main/config/modules/xinetd.mod index c93064ad767..fdc1b3c7b00 100644 --- a/jetty-server/src/main/config/modules/xinetd.mod +++ b/jetty-server/src/main/config/modules/xinetd.mod @@ -2,6 +2,8 @@ # Stats module # -DEPEND=server +[depend] +server +[xml] etc/jetty-xinetd.xml diff --git a/jetty-servlet/src/main/config/modules/servlet.mod b/jetty-servlet/src/main/config/modules/servlet.mod index a427eed5478..fdb65c57a16 100644 --- a/jetty-servlet/src/main/config/modules/servlet.mod +++ b/jetty-servlet/src/main/config/modules/servlet.mod @@ -2,6 +2,8 @@ # Jetty Servlet Module # -DEPEND=server +[depend] +server -LIB=lib/jetty-servlet-${jetty.version}.jar +[lib] +lib/jetty-servlet-${jetty.version}.jar diff --git a/jetty-servlets/src/main/config/modules/servlets.mod b/jetty-servlets/src/main/config/modules/servlets.mod index 3d471891dab..02cd72b852c 100644 --- a/jetty-servlets/src/main/config/modules/servlets.mod +++ b/jetty-servlets/src/main/config/modules/servlets.mod @@ -2,6 +2,8 @@ # Jetty Servlets Module # -DEPEND=servlet +[depend] +servlet -LIB=lib/jetty-servlets-${jetty.version}.jar +[lib] +lib/jetty-servlets-${jetty.version}.jar diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod index 10750265b56..7dfa4b85115 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod @@ -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=--exec \ No newline at end of file +[ini] +-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar +--exec \ No newline at end of file diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/spdy.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/spdy.mod index 4661fe7e249..2fb30355db2 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/spdy.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/spdy.mod @@ -1,12 +1,15 @@ +[depend] +ssl +npn -DEPEND=ssl -DEPEND=npn - -LIB=lib/spdy/*.jar +[lib] +lib/spdy/*.jar +[xml] etc/jetty-ssl.xml etc/jetty-spdy.xml -INI=spdy.port=8443 -INI=spdy.timeout=30000 -INI=#spdy.initialWindowSize=65536 \ No newline at end of file +[ini] +spdy.port=8443 +spdy.timeout=30000 +#spdy.initialWindowSize=65536 \ No newline at end of file diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/BaseHome.java b/jetty-start/src/main/java/org/eclipse/jetty/start/BaseHome.java index 8e519db5a3f..3cd5199601b 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/BaseHome.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/BaseHome.java @@ -50,20 +50,22 @@ public class BaseHome { try { - this.baseDir = new File(System.getProperty("jetty.base",System.getProperty("user.dir","."))); - URL jarfile=this.getClass().getClassLoader().getResource("org/eclipse/jetty/start/BaseHome.class"); - if (jarfile!=null) + this.baseDir = new File(System.getProperty("jetty.base",System.getProperty("user.dir","."))); + URL jarfile = this.getClass().getClassLoader().getResource("org/eclipse/jetty/start/BaseHome.class"); + if (jarfile != null) { - Matcher m =Pattern.compile("jar:(file:.*)!/org/eclipse/jetty/start/BaseHome.class").matcher(jarfile.toString()); + Matcher m = Pattern.compile("jar:(file:.*)!/org/eclipse/jetty/start/BaseHome.class").matcher(jarfile.toString()); if (m.matches()) - homeDir=new File(new URI(m.group(1))).getParentFile(); + { + homeDir = new File(new URI(m.group(1))).getParentFile(); + } } - homeDir = new File(System.getProperty("jetty.home",(homeDir==null?baseDir:homeDir).getAbsolutePath())); - - baseDir=baseDir.getAbsoluteFile().getCanonicalFile(); - homeDir=homeDir.getAbsoluteFile().getCanonicalFile(); + homeDir = new File(System.getProperty("jetty.home",(homeDir == null?baseDir:homeDir).getAbsolutePath())); + + baseDir = baseDir.getAbsoluteFile().getCanonicalFile(); + homeDir = homeDir.getAbsoluteFile().getCanonicalFile(); } - catch(IOException | URISyntaxException e) + catch (IOException | URISyntaxException e) { throw new RuntimeException(e); } @@ -71,8 +73,15 @@ public class BaseHome public BaseHome(File homeDir, File baseDir) { - this.homeDir = homeDir; - this.baseDir = baseDir == null?homeDir:baseDir; + try + { + this.homeDir = homeDir.getCanonicalFile(); + this.baseDir = baseDir == null?this.homeDir:baseDir.getCanonicalFile(); + } + catch (IOException e) + { + throw new RuntimeException(e); + } } public String getBase() diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/DownloadArg.java b/jetty-start/src/main/java/org/eclipse/jetty/start/DownloadArg.java new file mode 100644 index 00000000000..837b33cc72d --- /dev/null +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/DownloadArg.java @@ -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 :"); + } + 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(); + } +} \ No newline at end of file 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 ce1fc1a7917..1c6b616bb9b 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 @@ -29,7 +29,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.io.OutputStream; -import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -38,18 +37,14 @@ import java.net.InetAddress; import java.net.Socket; import java.net.SocketTimeoutException; import java.net.URL; -import java.nio.file.Files; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Locale; -import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.eclipse.jetty.start.StartArgs.DownloadArg; - /** * Main start class. *

@@ -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("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; for (File element : classpath.getElements()) @@ -335,6 +330,166 @@ public class Main 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 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 processCommandLine(cmdLine.toArray(new String[cmdLine.size()])) */ @@ -481,19 +636,18 @@ public class Main } } - // Initialize for (String module : args.getModuleStartIni()) { moduleIni(args,module,true,true); } - + // Initialize for (String module : args.getModuleIni()) { moduleIni(args,module,true,false); } - + // Informational command line, don't run jetty if (!args.isRun()) { @@ -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 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) { String usageResource = "org/eclipse/jetty/start/usage.txt"; diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java index 026547b797c..c0563b72a18 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java @@ -18,8 +18,10 @@ package org.eclipse.jetty.start; +import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.IOException; import java.text.CollationKey; import java.text.Collator; @@ -30,12 +32,15 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; +import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.omg.CORBA.INITIALIZE; + /** * Represents a Module metadata, as defined in Jetty. */ -public class Module extends TextFile +public class Module // extends TextFile { public static class NameComparator implements Comparator { @@ -50,7 +55,7 @@ public class Module extends TextFile return k1.compareTo(k2); } } - + public static class DepthComparator implements Comparator { private Collator collator = Collator.getInstance(); @@ -71,6 +76,8 @@ public class Module extends TextFile } } + /** The file of the module */ + private File file; /** The name of this Module */ private String name; /** The depth of the module in the tree */ @@ -90,8 +97,7 @@ public class Module extends TextFile /** List of library options for this Module */ private List libs; /** List of downloads for this Module */ - private List downloads; - + private List downloads; /** Is this Module enabled via start.jar command line, start.ini, or start.d/*.ini ? */ private boolean enabled = false; @@ -100,11 +106,14 @@ public class Module extends TextFile public Module(File file) throws FileNotFoundException, IOException { - super(file); + this.file = file; String name = file.getName(); // Strip .ini name = Pattern.compile(".mod$",Pattern.CASE_INSENSITIVE).matcher(name).replaceFirst(""); + + init(); + process(); } public void addChildEdge(Module child) @@ -201,12 +210,12 @@ public class Module extends TextFile { return initialise; } - + public List getDownloads() { return downloads; } - + @Override public int hashCode() { @@ -216,22 +225,21 @@ public class Module extends TextFile return result; } - @Override public void init() { - String name = getFile().getName(); + String name = file.getName(); // Strip .ini this.name = Pattern.compile(".mod$",Pattern.CASE_INSENSITIVE).matcher(name).replaceFirst(""); - parentNames=new HashSet<>(); - optionalParentNames=new HashSet<>(); - parentEdges=new HashSet<>(); - childEdges=new HashSet<>(); - xmls=new ArrayList<>(); - initialise=new ArrayList<>(); - libs=new ArrayList<>(); - downloads=new ArrayList<>(); + parentNames = new HashSet<>(); + optionalParentNames = new HashSet<>(); + parentEdges = new HashSet<>(); + childEdges = new HashSet<>(); + xmls = new ArrayList<>(); + initialise = new ArrayList<>(); + libs = new ArrayList<>(); + downloads = new ArrayList<>(); } public boolean isEnabled() @@ -239,61 +247,69 @@ public class Module extends TextFile return enabled; } - @Override - public void process(String line) + public void process() throws FileNotFoundException, IOException { - boolean handled = false; + Pattern section = Pattern.compile("\\s*\\[([^]]*)\\]\\s*"); - if (line == null) + if (!FS.canReadFile(file)) { - - } - - // 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); + StartLog.debug("Skipping read of missing file: %s",file.getAbsolutePath()); 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) @@ -310,17 +326,17 @@ public class Module extends TextFile { this.sources.addAll(sources); } - + public void clearSources() { this.sources.clear(); } - + public Set getSources() { return Collections.unmodifiableSet(sources); } - + @Override public String toString() { @@ -333,5 +349,4 @@ public class Module extends TextFile str.append(']'); return str.toString(); } - } diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java index 87c2136a660..57f4cee27dd 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java @@ -39,76 +39,7 @@ import java.util.Set; */ 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 = ""; - public static final String VERSION; static @@ -148,10 +79,8 @@ public class StartArgs private List jvmArgs = new ArrayList<>(); private List moduleIni = new ArrayList<>(); private List moduleStartIni = new ArrayList<>(); - private List modulePersistEnable = new ArrayList<>(); - private List modulePersistDisable = new ArrayList<>(); - private Modules allModules; + private Modules allModules; // Should the server be run? private boolean run = true; private boolean help = false; @@ -161,6 +90,7 @@ public class StartArgs private boolean listConfig = false; private boolean version = false; private boolean dryRun = false; + private boolean exec = false; public StartArgs(String[] commandLineArgs) @@ -169,30 +99,9 @@ public class StartArgs classpath = new Classpath(); } - static DownloadArg toDownloadArg(String uriLocation) - { - String parts[] = uriLocation.split(":",3); - if (parts.length != 3) - { - throw new IllegalArgumentException("Not :"); - } - 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) { - DownloadArg arg=toDownloadArg(uriLocation); + DownloadArg arg = new DownloadArg(uriLocation); if (!downloads.contains(arg)) { downloads.add(arg); @@ -452,16 +361,6 @@ public class StartArgs return this.commandLine; } - public List getModuleIni() - { - return moduleIni; - } - - public List getModuleStartIni() - { - return moduleStartIni; - } - public List getDownloads() { @@ -540,14 +439,14 @@ public class StartArgs return System.getProperty("main.class",mainclass); } - public List getModulePersistDisable() + public List getModuleIni() { - return modulePersistDisable; + return moduleIni; } - public List getModulePersistEnable() + public List getModuleStartIni() { - return modulePersistEnable; + return moduleStartIni; } public Properties getProperties() @@ -648,11 +547,6 @@ public class StartArgs return listModules; } - public boolean isModulePersistenceChanging() - { - return (modulePersistDisable.size() > 0) || (modulePersistEnable.size() > 0); - } - public boolean isRun() { return run; @@ -685,11 +579,25 @@ public class StartArgs } } - public void parse(String arg, String source) + public void parse(final String rawarg, String source) { - if (arg.trim().startsWith("#")) + if (rawarg == null) + { return; - + } + + final String arg = rawarg.trim(); + + if (arg.length() <= 0) + { + return; + } + + if (arg.startsWith("#")) + { + return; + } + if ("--help".equals(arg) || "-?".equals(arg)) { if (!CMD_LINE_SOURCE.equals(source)) @@ -768,7 +676,9 @@ public class StartArgs if (arg.startsWith("--module-ini=")) { if (!CMD_LINE_SOURCE.equals(source)) + { throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source); + } moduleIni.addAll(getValues(arg)); run = false; return; @@ -777,7 +687,9 @@ public class StartArgs if (arg.startsWith("--module-start-ini=")) { if (!CMD_LINE_SOURCE.equals(source)) + { throw new UsageException(ERR_BAD_ARG,"%s not allowed in %s",arg,source); + } moduleStartIni.addAll(getValues(arg)); run = false; return; @@ -799,28 +711,6 @@ public class StartArgs 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) if (arg.startsWith("-D")) { @@ -873,7 +763,7 @@ public class StartArgs } // 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() @@ -904,16 +794,6 @@ public class StartArgs this.allModules = allModules; } - public void setModulePersistDisable(List modulePersistDisable) - { - this.modulePersistDisable = modulePersistDisable; - } - - public void setModulePersistEnable(List modulePersistEnable) - { - this.modulePersistEnable = modulePersistEnable; - } - @Override public String toString() { 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 6c9f975e1b7..6817c422e8e 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 @@ -59,23 +59,28 @@ Module Management: o The ${jetty.base}/start.d/*.ini files --module= - 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 or ${jetty.base}/start.d/*.ini files. --module-ini= - Will enable a module by adding an ini file to the - ${jetty.base}/start.d/ directory from the template - contained in the module definition. Transitive - dependencies are followed and ini files are created - for them if they too have a ini template. + Enable a module via creation of an ini file in the + ${jetty.base}/start.d/ directory. + Uses ini template that the module itself maintains. + Transitive module dependencies are followed and all + 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= - Will enable a module by appending lines to the - ${jetty.base}/start.ini file from the template - contained in the module definition. Transitive - dependencies are followed and lines are appended - for them if they too have a ini template. + Enable a module by appending lines to the + ${jetty.base}/start.ini file. + Lines that are added come from the ini template that + the module itself maintains. + 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: -------------------------------- diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java index 773d91be1e8..e7f3e956ee2 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/BaseHomeTest.java @@ -39,7 +39,7 @@ public class BaseHomeTest { actual.add(hb.toShortForm(file)); } - Assert.assertThat(message,actual,containsInAnyOrder(expected.toArray())); + Assert.assertThat(message + ": " + Main.join(actual,", "),actual,containsInAnyOrder(expected.toArray())); } @Test @@ -76,7 +76,7 @@ public class BaseHomeTest assertFileList(hb,"Files found",expected,files); } - + @Test public void testListFiles_Filtered_OnlyHome() throws IOException { @@ -84,7 +84,7 @@ public class BaseHomeTest File baseDir = null; BaseHome hb = new BaseHome(homeDir,baseDir); - List files = hb.listFiles("/start.d", new FS.IniFilter()); + List files = hb.listFiles("/start.d",new FS.IniFilter()); List expected = new ArrayList<>(); expected.add("${jetty.home}/start.d/jmx.ini"); @@ -120,8 +120,10 @@ public class BaseHomeTest public void testDefault() throws IOException { BaseHome bh = new BaseHome(); + Assert.assertThat("Home",bh.getHome(),notNullValue()); + Assert.assertThat("Base",bh.getBase(),notNullValue()); } - + @Test public void testGetFile_Both() throws IOException { diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java index ff39017e9e3..8484add4c64 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigurationAssert.java @@ -31,7 +31,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.eclipse.jetty.start.StartArgs.DownloadArg; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.junit.Assert; diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java index fadd30c2764..70aac2317b2 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java @@ -42,7 +42,7 @@ public class ModulesTest Modules modules = new Modules(); modules.registerAll(basehome); - Assert.assertThat("Module count",modules.count(),is(29)); + Assert.assertThat("Module count",modules.count(),is(28)); } @Test diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java b/jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java index 609f815eef9..ebc67361be7 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/TestUseCases.java @@ -67,5 +67,4 @@ public class TestUseCases { assertUseCase("home","base.with.db","assert-with-db.txt"); } - } diff --git a/jetty-start/src/test/resources/jetty home with spaces/modules/base.mod b/jetty-start/src/test/resources/jetty home with spaces/modules/base.mod index 7d52330120e..f14d52a29c1 100644 --- a/jetty-start/src/test/resources/jetty home with spaces/modules/base.mod +++ b/jetty-start/src/test/resources/jetty home with spaces/modules/base.mod @@ -1 +1,2 @@ -LIB=lib/example*with spaces.jar \ No newline at end of file +[lib] +lib/example*with spaces.jar \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/base.with.db/modules/db.mod b/jetty-start/src/test/resources/usecases/base.with.db/modules/db.mod index 444d0eeeecc..5acded8b285 100644 --- a/jetty-start/src/test/resources/usecases/base.with.db/modules/db.mod +++ b/jetty-start/src/test/resources/usecases/base.with.db/modules/db.mod @@ -1,8 +1,11 @@ -DEPEND=deploy -DEPEND=jndi -DEPEND=plus +[depend] +deploy +jndi +plus -LIB=lib/db/*.jar +[lib] +lib/db/*.jar +[xml] etc/jetty-db.xml diff --git a/jetty-start/src/test/resources/usecases/base.with.module.persistence/modules/enabled b/jetty-start/src/test/resources/usecases/base.with.module.persistence/modules/enabled deleted file mode 100644 index 9fe8112ed80..00000000000 --- a/jetty-start/src/test/resources/usecases/base.with.module.persistence/modules/enabled +++ /dev/null @@ -1,2 +0,0 @@ -https -websocket \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/base.with.module.persistence/start.d/requestlog.ini b/jetty-start/src/test/resources/usecases/base.with.module.persistence/start.d/requestlog.ini deleted file mode 100644 index 59a4ac4759e..00000000000 --- a/jetty-start/src/test/resources/usecases/base.with.module.persistence/start.d/requestlog.ini +++ /dev/null @@ -1,2 +0,0 @@ - ---module=requestlog diff --git a/jetty-start/src/test/resources/usecases/base.with.module.persistence/start.d/websocket.ini b/jetty-start/src/test/resources/usecases/base.with.module.persistence/start.d/websocket.ini deleted file mode 100644 index 1b62c595977..00000000000 --- a/jetty-start/src/test/resources/usecases/base.with.module.persistence/start.d/websocket.ini +++ /dev/null @@ -1,2 +0,0 @@ - ---module=websocket diff --git a/jetty-start/src/test/resources/usecases/base.with.module.persistence/start.ini b/jetty-start/src/test/resources/usecases/base.with.module.persistence/start.ini deleted file mode 100644 index 3e513e792d1..00000000000 --- a/jetty-start/src/test/resources/usecases/base.with.module.persistence/start.ini +++ /dev/null @@ -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 diff --git a/jetty-start/src/test/resources/usecases/home/modules/annotations.mod b/jetty-start/src/test/resources/usecases/home/modules/annotations.mod index 3470bf75c79..65e4654127d 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/annotations.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/annotations.mod @@ -2,13 +2,16 @@ # Jetty Annotation Scanning Module # +[depend] # Annotations needs plus, and jndi features -DEPEND=plus +plus +[lib] # Annotations needs jetty annotation jars -LIB=lib/jetty-annotations-${jetty.version}.jar +lib/jetty-annotations-${jetty.version}.jar # Need annotation processing jars too -LIB=lib/annotations/*.jar +lib/annotations/*.jar +[xml] # Enable annotation scanning webapp configurations etc/jetty-annotations.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/base.mod b/jetty-start/src/test/resources/usecases/home/modules/base.mod index d3e2ab8fd04..ad8ea320882 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/base.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/base.mod @@ -2,7 +2,10 @@ # 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/jetty-io-${jetty.version}.jar +[lib] +lib/jetty-util-${jetty.version}.jar +lib/jetty-io-${jetty.version}.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/client.mod b/jetty-start/src/test/resources/usecases/home/modules/client.mod index f434cdc0870..6788eacf79c 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/client.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/client.mod @@ -2,5 +2,6 @@ # Client Feature # +[lib] # Client jars -LIB=lib/jetty-client-${jetty.version}.jar +lib/jetty-client-${jetty.version}.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/debug.mod b/jetty-start/src/test/resources/usecases/home/modules/debug.mod index 8cdf5b94ab6..f740ea2c762 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/debug.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/debug.mod @@ -2,6 +2,8 @@ # Debug module # -DEPEND=server +[depend] +server +[xml] etc/jetty-debug.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/demo.mod b/jetty-start/src/test/resources/usecases/home/modules/demo.mod deleted file mode 100644 index af06453d839..00000000000 --- a/jetty-start/src/test/resources/usecases/home/modules/demo.mod +++ /dev/null @@ -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 diff --git a/jetty-start/src/test/resources/usecases/home/modules/deploy.mod b/jetty-start/src/test/resources/usecases/home/modules/deploy.mod index 47fc62c1774..94c0e403168 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/deploy.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/deploy.mod @@ -2,10 +2,13 @@ # Deploy Feature # -DEPEND=webapp +[depend] +webapp +[lib] # Deploy jars -LIB=lib/jetty-deploy-${jetty.version}.jar +lib/jetty-deploy-${jetty.version}.jar +[xml] # Deploy configuration etc/jetty-deploy.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/http.mod b/jetty-start/src/test/resources/usecases/home/modules/http.mod index 94eed962e9b..85154141acc 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/http.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/http.mod @@ -2,6 +2,8 @@ # Jetty HTTP Server # -DEPEND=server +[depend] +server +[xml] etc/jetty-http.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/https.mod b/jetty-start/src/test/resources/usecases/home/modules/https.mod index 5e930e934f7..281c5dba040 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/https.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/https.mod @@ -2,7 +2,9 @@ # Jetty HTTP Server # -DEPEND=server +[depend] +server +[xml] etc/jetty-ssl.xml etc/jetty-https.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/ipaccess.mod b/jetty-start/src/test/resources/usecases/home/modules/ipaccess.mod index f99f26ec3e3..956ea0f2e3a 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/ipaccess.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/ipaccess.mod @@ -2,6 +2,8 @@ # IPAccess module # -DEPEND=server +[depend] +server +[xml] etc/jetty-ipaccess.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/jaas.mod b/jetty-start/src/test/resources/usecases/home/modules/jaas.mod index 2a608c74874..9fb04f7a57d 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/jaas.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/jaas.mod @@ -2,10 +2,13 @@ # JAAS Feature # -DEPEND=server +[depend] +server +[lib] # JAAS jars -LIB=lib/jetty-jaas-${jetty.version}.jar +lib/jetty-jaas-${jetty.version}.jar +[xml] # JAAS configuration etc/jetty-jaas.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/jmx.mod b/jetty-start/src/test/resources/usecases/home/modules/jmx.mod index 2a7922690e9..fd8740ae8d7 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/jmx.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/jmx.mod @@ -2,8 +2,10 @@ # JMX Feature # +[lib] # JMX jars (as defined in start.config) -LIB=lib/jetty-jmx-${jetty.version}.jar +lib/jetty-jmx-${jetty.version}.jar +[xml] # JMX configuration etc/jetty-jmx.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/jndi.mod b/jetty-start/src/test/resources/usecases/home/modules/jndi.mod index cfdcc526142..33c077ce684 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/jndi.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/jndi.mod @@ -2,8 +2,10 @@ # JNDI Support # -DEPEND=server +[depend] +server -LIB=lib/jetty-jndi-${jetty.version}.jar -LIB=lib/jndi/*.jar +[lib] +lib/jetty-jndi-${jetty.version}.jar +lib/jndi/*.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/jsp.mod b/jetty-start/src/test/resources/usecases/home/modules/jsp.mod index d24dddf44d5..f85530d3c8a 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/jsp.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/jsp.mod @@ -2,7 +2,9 @@ # Jetty Servlet Module # -DEPEND=servlet +[depend] +servlet -LIB=lib/jsp/*.jar +[lib] +lib/jsp/*.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/lowresources.mod b/jetty-start/src/test/resources/usecases/home/modules/lowresources.mod index 578d8165edd..4ca96de10ee 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/lowresources.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/lowresources.mod @@ -2,6 +2,8 @@ # Low Resources module # -DEPEND=server +[depend] +server +[xml] etc/jetty-lowresources.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/monitor.mod b/jetty-start/src/test/resources/usecases/home/modules/monitor.mod index 249ccef15d1..67f006d0c4c 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/monitor.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/monitor.mod @@ -2,9 +2,12 @@ # Jetty Monitor module # -DEPEND=server -DEPEND=client +[depend] +server +client -LIB=lib/jetty-monitor-${jetty.version}.jar +[lib] +lib/jetty-monitor-${jetty.version}.jar +[xml] etc/jetty-monitor.xml \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/home/modules/npn.mod b/jetty-start/src/test/resources/usecases/home/modules/npn.mod index c32988666a4..1f2856c73e0 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/npn.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/npn.mod @@ -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 \ No newline at end of file +[ini] +-Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar \ No newline at end of file diff --git a/jetty-start/src/test/resources/usecases/home/modules/plus.mod b/jetty-start/src/test/resources/usecases/home/modules/plus.mod index caa799376a6..b781f00bf2f 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/plus.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/plus.mod @@ -2,11 +2,14 @@ # Jetty Proxy module # -DEPEND=server -DEPEND=security -DEPEND=jndi +[depend] +server +security +jndi -LIB=lib/jetty-plus-${jetty.version}.jar +[lib] +lib/jetty-plus-${jetty.version}.jar +[xml] # Plus requires configuration etc/jetty-plus.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/proxy.mod b/jetty-start/src/test/resources/usecases/home/modules/proxy.mod index 5ab6e70a880..7873329afaa 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/proxy.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/proxy.mod @@ -2,10 +2,13 @@ # Jetty Proxy module # -DEPEND=server -DEPEND=client +[depend] +server +client -LIB=lib/jetty-proxy-${jetty.version}.jar +[lib] +lib/jetty-proxy-${jetty.version}.jar +[xml] # Proxy requires configuration etc/jetty-proxy.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/requestlog.mod b/jetty-start/src/test/resources/usecases/home/modules/requestlog.mod index 060ca9f0a22..2b048dbc767 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/requestlog.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/requestlog.mod @@ -2,6 +2,8 @@ # Request Log module # -DEPEND=server +[depend] +server +[xml] etc/jetty-requestlog.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/rewrite.mod b/jetty-start/src/test/resources/usecases/home/modules/rewrite.mod index d5ccf960410..85fe5f090d1 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/rewrite.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/rewrite.mod @@ -2,9 +2,12 @@ # 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 etc/jetty-rewrite.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/security.mod b/jetty-start/src/test/resources/usecases/home/modules/security.mod index 5a3c4a368a6..ba3163275f5 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/security.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/security.mod @@ -2,6 +2,8 @@ # Jetty Security Module # -DEPEND=server +[depend] +server -LIB=lib/jetty-security-${jetty.version}.jar +[lib] +lib/jetty-security-${jetty.version}.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/server.mod b/jetty-start/src/test/resources/usecases/home/modules/server.mod index aa6cad6b0e6..d0c2de35d74 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/server.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/server.mod @@ -2,14 +2,17 @@ # Base server # -DEPEND=base -DEPEND=xml +[depend] +base +xml -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/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 +[xml] # Annotations needs annotations configuration etc/jetty.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/servlet.mod b/jetty-start/src/test/resources/usecases/home/modules/servlet.mod index a427eed5478..fdb65c57a16 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/servlet.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/servlet.mod @@ -2,6 +2,8 @@ # Jetty Servlet Module # -DEPEND=server +[depend] +server -LIB=lib/jetty-servlet-${jetty.version}.jar +[lib] +lib/jetty-servlet-${jetty.version}.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/spdy.mod b/jetty-start/src/test/resources/usecases/home/modules/spdy.mod index cd45fad3a8e..92e31a2b231 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/spdy.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/spdy.mod @@ -1,8 +1,11 @@ -DEPEND=server -DEPEND=npn +[depend] +server +npn -LIB=lib/spdy/*.jar +[lib] +lib/spdy/*.jar +[xml] etc/jetty-ssl.xml etc/jetty-spdy.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/stats.mod b/jetty-start/src/test/resources/usecases/home/modules/stats.mod index cd56d5b4d7b..0922469cdfb 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/stats.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/stats.mod @@ -2,6 +2,8 @@ # Stats module # -DEPEND=server +[depend] +server +[xml] etc/jetty-stats.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/webapp.mod b/jetty-start/src/test/resources/usecases/home/modules/webapp.mod index c39d5aae063..f62c5545555 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/webapp.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/webapp.mod @@ -2,6 +2,8 @@ # Base server # -DEPEND=servlet +[depend] +servlet -LIB=lib/jetty-webapp-${jetty.version}.jar +[lib] +lib/jetty-webapp-${jetty.version}.jar diff --git a/jetty-start/src/test/resources/usecases/home/modules/websocket.mod b/jetty-start/src/test/resources/usecases/home/modules/websocket.mod index a74a1072ac2..f45babd8863 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/websocket.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/websocket.mod @@ -3,12 +3,15 @@ # # WebSocket needs Annotations feature -DEPEND=server -DEPEND=annotations +[depend] +server +annotations # WebSocket needs websocket jars (as defined in start.config) -LIB=lib/websocket/*.jar +[lib] +lib/websocket/*.jar # WebSocket needs websocket configuration +[xml] etc/jetty-websockets.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/xinetd.mod b/jetty-start/src/test/resources/usecases/home/modules/xinetd.mod index c93064ad767..fdc1b3c7b00 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/xinetd.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/xinetd.mod @@ -2,6 +2,8 @@ # Stats module # -DEPEND=server +[depend] +server +[xml] etc/jetty-xinetd.xml diff --git a/jetty-start/src/test/resources/usecases/home/modules/xml.mod b/jetty-start/src/test/resources/usecases/home/modules/xml.mod index 949e2057117..d53107a84f5 100644 --- a/jetty-start/src/test/resources/usecases/home/modules/xml.mod +++ b/jetty-start/src/test/resources/usecases/home/modules/xml.mod @@ -2,7 +2,9 @@ # Jetty XML Configuration # -DEPEND=base +[depend] +base -LIB=lib/jetty-xml-${jetty.version}.jar +[lib] +lib/jetty-xml-${jetty.version}.jar diff --git a/jetty-webapp/src/main/config/modules/webapp.mod b/jetty-webapp/src/main/config/modules/webapp.mod index c39d5aae063..f62c5545555 100644 --- a/jetty-webapp/src/main/config/modules/webapp.mod +++ b/jetty-webapp/src/main/config/modules/webapp.mod @@ -2,6 +2,8 @@ # Base server # -DEPEND=servlet +[depend] +servlet -LIB=lib/jetty-webapp-${jetty.version}.jar +[lib] +lib/jetty-webapp-${jetty.version}.jar diff --git a/jetty-websocket/javax-websocket-server-impl/src/main/config/modules/websocket.mod b/jetty-websocket/javax-websocket-server-impl/src/main/config/modules/websocket.mod index a74a1072ac2..ecf5b3c0709 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/main/config/modules/websocket.mod +++ b/jetty-websocket/javax-websocket-server-impl/src/main/config/modules/websocket.mod @@ -2,13 +2,16 @@ # WebSocket Feature # +[depend] # WebSocket needs Annotations feature -DEPEND=server -DEPEND=annotations +server +annotations +[lib] # WebSocket needs websocket jars (as defined in start.config) -LIB=lib/websocket/*.jar +lib/websocket/*.jar +[xml] # WebSocket needs websocket configuration etc/jetty-websockets.xml diff --git a/tests/test-webapps/test-jaas-webapp/pom.xml b/tests/test-webapps/test-jaas-webapp/pom.xml index ba827d2d4b8..9e58548f569 100644 --- a/tests/test-webapps/test-jaas-webapp/pom.xml +++ b/tests/test-webapps/test-jaas-webapp/pom.xml @@ -34,7 +34,7 @@ java.security.auth.login.config - ${basedir}/src/main/config/demo/login.conf + ${basedir}/src/main/config/demo-base/etc/login.conf diff --git a/tests/test-webapps/test-jaas-webapp/src/main/config/demo/login.conf b/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/etc/login.conf similarity index 65% rename from tests/test-webapps/test-jaas-webapp/src/main/config/demo/login.conf rename to tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/etc/login.conf index aa0736f41a8..a97b0eddeeb 100644 --- a/tests/test-webapps/test-jaas-webapp/src/main/config/demo/login.conf +++ b/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/etc/login.conf @@ -1,5 +1,5 @@ xyz { org.eclipse.jetty.jaas.spi.PropertyFileLoginModule required debug="true" -file="${jetty.home}/demo/login.properties"; +file="${jetty.base}/etc/login.properties"; }; diff --git a/tests/test-webapps/test-jaas-webapp/src/main/config/demo/login.properties b/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/etc/login.properties similarity index 100% rename from tests/test-webapps/test-jaas-webapp/src/main/config/demo/login.properties rename to tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/etc/login.properties diff --git a/tests/test-webapps/test-jaas-webapp/src/main/config/demo/webapps/test-jaas.xml b/tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml similarity index 100% rename from tests/test-webapps/test-jaas-webapp/src/main/config/demo/webapps/test-jaas.xml rename to tests/test-webapps/test-jaas-webapp/src/main/config/demo-base/webapps/test-jaas.xml diff --git a/tests/test-webapps/test-jaas-webapp/src/main/webapp/index.html b/tests/test-webapps/test-jaas-webapp/src/main/webapp/index.html index 5b4f50da8c2..521db42423e 100644 --- a/tests/test-webapps/test-jaas-webapp/src/main/webapp/index.html +++ b/tests/test-webapps/test-jaas-webapp/src/main/webapp/index.html @@ -24,7 +24,7 @@ etc/jetty-jaas.xml

-

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.

+

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.

The full source of this demonstration is available here.

diff --git a/tests/test-webapps/test-jetty-webapp/pom.xml b/tests/test-webapps/test-jetty-webapp/pom.xml index 231bde47b13..9b6377b4346 100644 --- a/tests/test-webapps/test-jetty-webapp/pom.xml +++ b/tests/test-webapps/test-jetty-webapp/pom.xml @@ -147,7 +147,7 @@ Test Realm - src/main/config/demo/realm.properties + src/main/config/demo-base/etc/realm.properties diff --git a/tests/test-webapps/test-jetty-webapp/src/main/assembly/embedded-jetty-web-for-webbundle.xml b/tests/test-webapps/test-jetty-webapp/src/main/assembly/embedded-jetty-web-for-webbundle.xml index 8c10dad34b3..911b9479ff7 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/assembly/embedded-jetty-web-for-webbundle.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/assembly/embedded-jetty-web-for-webbundle.xml @@ -28,7 +28,7 @@ detected. true false /etc/webdefault.xml - /demo/override-web.xml + /etc/override-web.xml - - - - - - - - /demo/webapps - /etc/webdefault.xml - 1 - true - - - - - - - - - diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/demo/override-web.xml b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/override-web.xml similarity index 100% rename from tests/test-webapps/test-jetty-webapp/src/main/config/demo/override-web.xml rename to tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/override-web.xml diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/demo/realm.properties b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/realm.properties similarity index 100% rename from tests/test-webapps/test-jetty-webapp/src/main/config/demo/realm.properties rename to tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/realm.properties diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/demo/test-realm.xml b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml similarity index 97% rename from tests/test-webapps/test-jetty-webapp/src/main/config/demo/test-realm.xml rename to tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml index 97fccac33d4..d5c776ba08d 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/config/demo/test-realm.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/etc/test-realm.xml @@ -12,7 +12,7 @@ Test Realm - + 0 diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/start.ini b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/start.ini new file mode 100644 index 00000000000..d8f52628564 --- /dev/null +++ b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/start.ini @@ -0,0 +1,37 @@ +# +# Example of providing a demo configuration, using a ${jetty.base} +# + +# We want to serve content over http +--module=http +jetty.port=8080 + +# Have webapps be deployed normally from webapps directory +--module=deploy + +# We are using annotations + jndi +--module=annotations +--module=jndi + +# Enable security via jaas, and configure it +--module=jaas +jaas.login.conf=etc/login.conf + +# Enable rewrite examples +--module=rewrite +etc/demo-rewrite-rules.xml + +# The async behavior examples use http client to access remote systems +--module=client + +# Websocket chat examples needs websocket enabled +--module=websocket + +# Create and configure the test realm +etc/test-realm.xml +demo.realm=etc/realm.properties + +# Load test JNDI resources from lib/ext +--module=ext + + diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/demo/webapps/test.xml b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/webapps/test.xml similarity index 97% rename from tests/test-webapps/test-jetty-webapp/src/main/config/demo/webapps/test.xml rename to tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/webapps/test.xml index b26d9fc178f..09f59b7ce9f 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/config/demo/webapps/test.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/webapps/test.xml @@ -27,7 +27,7 @@ detected. true false /etc/webdefault.xml - /demo/override-web.xml + /etc/override-web.xml