diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java index 8b301d8035d..4a37c478968 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java @@ -58,6 +58,9 @@ import org.eclipse.jetty.xml.XmlConfiguration; * be configured by the XML and only the XML is deployed. * * + *

When deploying XML files, the property deployer.file is set to the file itself and + * deployer.dir is set to the directory of the XML file

+ * */ @ManagedObject("Provider for start-up deployement of webapps based on presence in directory") public class WebAppProvider extends ScanningAppProvider @@ -265,6 +268,8 @@ public class WebAppProvider extends ScanningAppProvider if (resource.exists() && FileID.isXmlFile(file)) { XmlConfiguration xmlc = new XmlConfiguration(resource.getURL()); + xmlc.getProperties().put("deployer.file",file.getCanonicalPath()); + xmlc.getProperties().put("deployer.dir",file.getParent()); xmlc.getIdMap().put("Server",getDeploymentManager().getServer()); if (getConfigurationManager() != null) diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index a256aeb297e..4c06ecd4549 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -99,7 +99,7 @@ war true ** - ${assembly-directory}/webapps + ${assembly-directory}/webapps-demos test.war @@ -109,7 +109,7 @@ war true ** - ${assembly-directory}/webapps + ${assembly-directory}/webapps-demos async-rest.war @@ -473,7 +473,7 @@ war true ** - ${assembly-directory}/webapps + ${assembly-directory}/webapps-demos spdy.war diff --git a/jetty-distribution/src/main/resources/etc/jetty-demos.xml b/jetty-distribution/src/main/resources/etc/jetty-demos.xml new file mode 100644 index 00000000000..f68feb36ea1 --- /dev/null +++ b/jetty-distribution/src/main/resources/etc/jetty-demos.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + /webapps-demos + /etc/webdefault.xml + 1 + true + + + + + diff --git a/jetty-distribution/src/main/resources/start.d/demos.ini b/jetty-distribution/src/main/resources/start.d/demos.ini new file mode 100644 index 00000000000..b96f6ae070e --- /dev/null +++ b/jetty-distribution/src/main/resources/start.d/demos.ini @@ -0,0 +1,9 @@ + +# Add the jetty client used by some demos +OPTIONS=client + +# Add the test authentication realm +etc/test-realm.xml + +# Add the deployer provider for webapps-demos +etc/jetty-demos.xml diff --git a/jetty-distribution/src/main/resources/start.ini b/jetty-distribution/src/main/resources/start.ini index 29f88a4b252..7b269c65247 100644 --- a/jetty-distribution/src/main/resources/start.ini +++ b/jetty-distribution/src/main/resources/start.ini @@ -78,16 +78,23 @@ #=========================================================== #=========================================================== -# Default Server Options -# Use the core server jars with websocket on the classpath +# Common Options +# Use the core server jars on the classpath +# Enables websocket # Add the contents of the resources directory to the classpath # Add jars discovered in lib/ext to the classpath -# Include the core jetty configuration file -# Lookup additional ini files in start.d #----------------------------------------------------------- -OPTIONS=Server,websocket,resources,ext +OPTIONS=Server +OPTIONS=websocket +OPTIONS=resources +OPTIONS=ext +#OPTIONS=client +#=========================================================== + +#=========================================================== +# Include the core jetty configuration file +#----------------------------------------------------------- etc/jetty.xml -start.d/ #=========================================================== #=========================================================== @@ -114,7 +121,6 @@ etc/jetty-jmx.xml OPTIONS=jsp #=========================================================== - #=========================================================== # Annotations JNDI JASS processing #----------------------------------------------------------- @@ -175,3 +181,11 @@ etc/jetty-requestlog.xml # etc/jetty-debug.xml # etc/jetty-ipaccess.xml #=========================================================== + +#=========================================================== +# Lookup additional ini files in start.d +# THE DEMO WEBAPPS ARE CONFIGURED IN start.d/demo.ini +#----------------------------------------------------------- +start.d/ +#=========================================================== + diff --git a/jetty-distribution/src/main/resources/webapps-demos/README.TXT b/jetty-distribution/src/main/resources/webapps-demos/README.TXT new file mode 100644 index 00000000000..d7dd12cc4df --- /dev/null +++ b/jetty-distribution/src/main/resources/webapps-demos/README.TXT @@ -0,0 +1,6 @@ + +This is the webapps demo directory for the Jetty Server. +It is enabled by the file $JETTY_HOME/start.d/demos.ini +Remove that file or comment out it's contents to disable +the jetty demonstrations. + diff --git a/jetty-distribution/src/main/resources/webapps/ROOT/images/jetty-header.jpg b/jetty-distribution/src/main/resources/webapps-demos/ROOT/images/jetty-header.jpg similarity index 100% rename from jetty-distribution/src/main/resources/webapps/ROOT/images/jetty-header.jpg rename to jetty-distribution/src/main/resources/webapps-demos/ROOT/images/jetty-header.jpg diff --git a/jetty-distribution/src/main/resources/webapps/ROOT/images/webtide_logo.jpg b/jetty-distribution/src/main/resources/webapps-demos/ROOT/images/webtide_logo.jpg similarity index 100% rename from jetty-distribution/src/main/resources/webapps/ROOT/images/webtide_logo.jpg rename to jetty-distribution/src/main/resources/webapps-demos/ROOT/images/webtide_logo.jpg diff --git a/jetty-distribution/src/main/resources/webapps/ROOT/index.html b/jetty-distribution/src/main/resources/webapps-demos/ROOT/index.html similarity index 100% rename from jetty-distribution/src/main/resources/webapps/ROOT/index.html rename to jetty-distribution/src/main/resources/webapps-demos/ROOT/index.html diff --git a/jetty-distribution/src/main/resources/webapps/ROOT/jetty.css b/jetty-distribution/src/main/resources/webapps-demos/ROOT/jetty.css similarity index 100% rename from jetty-distribution/src/main/resources/webapps/ROOT/jetty.css rename to jetty-distribution/src/main/resources/webapps-demos/ROOT/jetty.css diff --git a/jetty-distribution/src/main/resources/webapps/javadoc.xml b/jetty-distribution/src/main/resources/webapps-demos/javadoc.xml similarity index 100% rename from jetty-distribution/src/main/resources/webapps/javadoc.xml rename to jetty-distribution/src/main/resources/webapps-demos/javadoc.xml diff --git a/jetty-distribution/src/main/resources/webapps/available.d/move-context.xml b/jetty-distribution/src/main/resources/webapps-demos/move-context.xml similarity index 92% rename from jetty-distribution/src/main/resources/webapps/available.d/move-context.xml rename to jetty-distribution/src/main/resources/webapps-demos/move-context.xml index 7821b3d903d..96ad68fdc52 100644 --- a/jetty-distribution/src/main/resources/webapps/available.d/move-context.xml +++ b/jetty-distribution/src/main/resources/webapps-demos/move-context.xml @@ -1,6 +1,7 @@ + /oldContextPath /test/dump/newContextPath diff --git a/jetty-distribution/src/main/resources/webapps/README.TXT b/jetty-distribution/src/main/resources/webapps/README.TXT index dc2b38915e3..16a92428ba3 100644 --- a/jetty-distribution/src/main/resources/webapps/README.TXT +++ b/jetty-distribution/src/main/resources/webapps/README.TXT @@ -2,24 +2,33 @@ This directory is scanned by the WebAppDeployer provider for web applications to deploy using the following conventions: -+ A directory called example/ will be deployed as a standard web -application if it contains a WEB-INF/ subdirectory, otherwise it will be -deployed as context of static content. The context path will be /example -(eg http://localhost:8080/example/) unless the base name is root, in -which case the context path is /. If the directory name ends with ".d" -it is ignored (by may be used by explicit configuration). - -+ A file called example.war will be deployed as a standard web application -with the context path /example (eg http://localhost:8080/example/). If he -base name is root, then the context path is /. If example.war and example/ ++ A file matching the pattern *.war will be deployed as a standard web +application with the context path set from the files basename. +So a file called "example.war" will be deployed with a context path of /example +and will be served at URLs like http://localhost:8080/example/). +If the base name is root, then the context path is /. If example.war and example/ exist, then only the WAR is deployed (which may use the directory as an unpack location). -+ An XML file like example.xml will be deployed as a context whose -configuration is defined by the XML. The context path must be set by -the configuration itself. If example.xml and example.war exist, then -only the XML is deployed (which may use the war in its configuration). ++ A directory will be deployed as a standard web application if it +contains a WEB-INF/ subdirectory, otherwise it will be deployed as +context of static content. The context path will be the filename. +So a directory called "example/" will have a context path of /example +If the basename is "root", then the context path is /. +If the directory name ends with ".d" it is ignored (and may be used +to hold other configuration files). + + ++ An XML file will be deployed as a context whose configuration is +defined by the XML. The context path must be set by the configuration +itself. If "example.xml" and "example.war" exist, then only the XML +is deployed (which may use the war in its configuration). This directory is scanned for additions, removals and updates for hot deployment. +The jetty demo webapps are not served from this directory. Instead +the $JETTY_HOME/start.d/demo.ini file configures the +$JETTY_HOME/webapps-demos directory as an alternate webapps deployment +directory. + diff --git a/jetty-distribution/src/main/resources/webapps/available.d/README.TXT b/jetty-distribution/src/main/resources/webapps/available.d/README.TXT deleted file mode 100644 index 10f0eae32f1..00000000000 --- a/jetty-distribution/src/main/resources/webapps/available.d/README.TXT +++ /dev/null @@ -1,3 +0,0 @@ - -This directory contains example context XML that may be deployed by -moving/copying/linking them to the ../../webapps directory. diff --git a/jetty-distribution/src/main/resources/webapps/available.d/resources.xml b/jetty-distribution/src/main/resources/webapps/available.d/resources.xml deleted file mode 100644 index 9ea0e18773b..00000000000 --- a/jetty-distribution/src/main/resources/webapps/available.d/resources.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - /resources - /resources/ - - - - - index.html - - - max-age=3600,public - - - - - diff --git a/tests/test-webapps/test-jaas-webapp/src/main/config/webapps/test-jaas.xml b/tests/test-webapps/test-jaas-webapp/src/main/config/webapps-demos/test-jaas.xml similarity index 100% rename from tests/test-webapps/test-jaas-webapp/src/main/config/webapps/test-jaas.xml rename to tests/test-webapps/test-jaas-webapp/src/main/config/webapps-demos/test-jaas.xml diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/start.d/test-realm.ini b/tests/test-webapps/test-jetty-webapp/src/main/config/start.d/test-realm.ini deleted file mode 100644 index cc93dc91186..00000000000 --- a/tests/test-webapps/test-jetty-webapp/src/main/config/start.d/test-realm.ini +++ /dev/null @@ -1 +0,0 @@ -etc/test-realm.xml \ No newline at end of file diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/webapps/test.d/override-web.xml b/tests/test-webapps/test-jetty-webapp/src/main/config/webapps-demos/test.d/override-web.xml similarity index 100% rename from tests/test-webapps/test-jetty-webapp/src/main/config/webapps/test.d/override-web.xml rename to tests/test-webapps/test-jetty-webapp/src/main/config/webapps-demos/test.d/override-web.xml diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/webapps/test.xml b/tests/test-webapps/test-jetty-webapp/src/main/config/webapps-demos/test.xml similarity index 94% rename from tests/test-webapps/test-jetty-webapp/src/main/config/webapps/test.xml rename to tests/test-webapps/test-jetty-webapp/src/main/config/webapps-demos/test.xml index c19f55c73d1..e0a408433fb 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/config/webapps/test.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/config/webapps-demos/test.xml @@ -20,7 +20,7 @@ detected. /test - /webapps/test.war + /test.war @@ -28,7 +28,7 @@ detected. true false /etc/webdefault.xml - /webapps/test.d/override-web.xml + /test.d/override-web.xml