jetty-9 moved the jetty demos to webapps-demos controlled by start.d/demos.ini

This commit is contained in:
Greg Wilkins 2012-11-19 18:35:32 +11:00
parent 67b5caadbb
commit 4bd36e3d38
19 changed files with 93 additions and 56 deletions

View File

@ -58,6 +58,9 @@ import org.eclipse.jetty.xml.XmlConfiguration;
* be configured by the XML and only the XML is deployed.
* </ul>
*
* <p>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</p>
*
*/
@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)

View File

@ -99,7 +99,7 @@
<type>war</type>
<overWrite>true</overWrite>
<includes>**</includes>
<outputDirectory>${assembly-directory}/webapps</outputDirectory>
<outputDirectory>${assembly-directory}/webapps-demos</outputDirectory>
<destFileName>test.war</destFileName>
</artifactItem>
<artifactItem>
@ -109,7 +109,7 @@
<type>war</type>
<overWrite>true</overWrite>
<includes>**</includes>
<outputDirectory>${assembly-directory}/webapps</outputDirectory>
<outputDirectory>${assembly-directory}/webapps-demos</outputDirectory>
<destFileName>async-rest.war</destFileName>
</artifactItem>
<artifactItem>
@ -473,7 +473,7 @@
<type>war</type>
<overWrite>true</overWrite>
<includes>**</includes>
<outputDirectory>${assembly-directory}/webapps</outputDirectory>
<outputDirectory>${assembly-directory}/webapps-demos</outputDirectory>
<destFileName>spdy.war</destFileName>
</artifactItem>
</artifactItems>

View File

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Create the Demo deployment manager provider -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Adds an WebAppProvider for the webapps-demos directory. -->
<!-- This configuration is enabled by $JETTY_HOME/start.d/demos.ini -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Ref id="DeploymentManager">
<Call id="demoProvider" name="addAppProvider">
<Arg>
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
<Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps-demos</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="." />/etc/webdefault.xml</Set>
<Set name="scanInterval">1</Set>
<Set name="extractWars">true</Set>
</New>
</Arg>
</Call>
</Ref>
</Configure>

View File

@ -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

View File

@ -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/
#===========================================================

View File

@ -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.

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- Example of a MovedContextHandler -->
<Configure class="org.eclipse.jetty.server.handler.MovedContextHandler">
<Set name="contextPath">/oldContextPath</Set>
<Set name="newContextURL">/test/dump/newContextPath</Set>

View File

@ -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.

View File

@ -1,3 +0,0 @@
This directory contains example context XML that may be deployed by
moving/copying/linking them to the ../../webapps directory.

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.eclipse.org/configure.dtd">
<!--
Configure a custom context for serving static resources
This context contains only a ResourceHandler
to serve static html files and images.
-->
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
<Set name="contextPath">/resources</Set>
<Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/resources/</Set>
<Set name="handler">
<New class="org.eclipse.jetty.server.handler.ResourceHandler">
<Set name="welcomeFiles">
<Array type="String">
<Item>index.html</Item>
</Array>
</Set>
<Set name="cacheControl">max-age=3600,public</Set>
</New>
</Set>
</Configure>

View File

@ -20,7 +20,7 @@ detected.
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/test</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/test.war</Set>
<Set name="war"><Property name="deployer.dir"/>/test.war</Set>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Optional context configuration -->
@ -28,7 +28,7 @@ detected.
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
<Set name="overrideDescriptor"><SystemProperty name="jetty.home" default="."/>/webapps/test.d/override-web.xml</Set>
<Set name="overrideDescriptor"><Property name="deployer.dir" default="."/>/test.d/override-web.xml</Set>
<!-- virtual hosts
<Set name="virtualHosts">