Documentation for GlobalWebAppConfigBinding. Resolves #2207

This commit is contained in:
WalkerWatch 2018-05-29 13:49:24 -04:00
parent 953611fb72
commit 65070e6b2a
4 changed files with 29 additions and 56 deletions

View File

@ -21,7 +21,7 @@
This chapter discusses various ways to deploy applications with Jetty.
Topics range from deployment bindings to deploying third party products.
It also includes information about the Deployment Manager, WebApp Provider, and Overlay Deployer.
It also includes information about the Deployment Manager and WebApp Provider.
include::anatomy-of-a-webapp.adoc[]
include::automatic-webapp-deployment.adoc[]

View File

@ -32,8 +32,8 @@ image:images/Jetty_DeployManager_DeploymentManager_Roles.png[image,width=195]
[[udm-application-providers]]
==== Application Providers
Before Jetty deploys an application, an link:{JDURL}/org/eclipse/jetty/deploy/AppProvider.html[AppProvider] identifies the App and then provides it to the `DeploymentManager`.
The main `AppProvider` with the Jetty distribution is the link:{JDURL}/org/eclipse/jetty/deploy/providers/WebAppProvider.html[WebAppProvider.]
Before Jetty deploys an application, an link:{JDURL}/org/eclipse/jetty/deploy/AppProvider.html[`AppProvider`] identifies the App and then provides it to the `DeploymentManager`.
The main `AppProvider` with the Jetty distribution is the link:{JDURL}/org/eclipse/jetty/deploy/providers/WebAppProvider.html[`WebAppProvider`.]
[[udm-application-lifecycle-graph]]
==== Application LifeCycle Graph
@ -63,15 +63,35 @@ Examples of new `AppLifeCycle.Binding` implementations that can be developed inc
There are four default bindings:
* link:{JDURL}/org/eclipse/jetty/deploy/bindings/StandardDeployer.html[StandardDeployer] — Deploys the ContextHandler into Jetty in the appropriate place.
* link:{JDURL}/org/eclipse/jetty/deploy/bindings/StandardStarter.html[StandardStarter] — Sets the ContextHandler to started and start accepting incoming requests.
* link:{JDURL}/org/eclipse/jetty/deploy/bindings/StandardStopper.html[StandardStopper] — Stops the ContextHandler and stops accepting incoming requests.
* link:{JDURL}/org/eclipse/jetty/deploy/bindings/StandardUndeployer.html[StandardUndeployer] — Removes the ContextHandler from Jetty.
* link:{JDURL}/org/eclipse/jetty/deploy/bindings/StandardDeployer.html[`StandardDeployer`] — Deploys the ContextHandler into Jetty in the appropriate place.
* link:{JDURL}/org/eclipse/jetty/deploy/bindings/StandardStarter.html[`StandardStarter`] — Sets the ContextHandler to started and start accepting incoming requests.
* link:{JDURL}/org/eclipse/jetty/deploy/bindings/StandardStopper.html[`StandardStopper`] — Stops the ContextHandler and stops accepting incoming requests.
* link:{JDURL}/org/eclipse/jetty/deploy/bindings/StandardUndeployer.html[`StandardUndeployer`] — Removes the ContextHandler from Jetty.
image:images/Jetty_DeployManager_DefaultAppLifeCycleBindings.png[image,width=851]
A fifth, non-standard binding, called link:{JDURL}/org/eclipse/jetty/deploy/bindings/DebugBinding.html[DebugBinding], is also available for debugging reasons; it logs the various transitions through the Application LifeCycle.
===== Using GlobalWebappConfigBinding
In addition to the LifeCycle bindings discussed above, there is also the link:https://www.eclipse.org/jetty/javadoc/current/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBinding.html[`GlobalWebappConfigBinding`] which, when added to the `DeploymentManager` will apply an additional configuration XML file to each webapp that it deploys.
This can useful when setting server or system classes, or when defining link:#override-web-xml[override descriptors.]
This configuration XML file will be _in addition to_ any context XML file that exists for the webapp; it will be applied _after_ any context XML files but _before_ the webapp is started.
The format for the XML file is the same as any context XML file and can be used to same parameters for a webapp.
To use this binding, you can either modify the existing `jetty-deploy.xml` which comes with the Jetty distribution (be sure to link:#startup-base-and-home[copy it to your $JETTY_BASE/etc directory first]), or by link:#custom-modules[creating a new module] file which calls to an additional XML file.
[source, xml, subs="{sub-order}"]
----
<Call name="addLifeCycleBinding">
<Arg>
<New class="org.eclipse.jetty.deploy.bindings.GlobalWebappConfigBinding" >
<Set name="jettyXml"><Property name="jetty.home" default="." />/etc/global-webapp-config.xml</Set>
</New>
</Arg>
</Call>
----
[[default-web-app-provider]]
==== Understanding the Default WebAppProvider
@ -119,7 +139,7 @@ monitoredDirName::
The file path or URL to the directory to scan for web applications.
Scanning follows these rules:
1. A base directory must exist.
2. Hidden Files (starting with `"."`) are ignored.
3. Directories with names ending in `".d"` are ignored.

View File

@ -1,44 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2018 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.
// ========================================================================
//
[[setting-deployment-bindings]]
=== Setting Deployment Bindings
Jetty provides __deployment bindings__, which allows access to the application lifecycle of `DeploymentManager`.
There are a handful of bindings that exist within the core distribution of Jetty:
* `StandardDeployer` (deploying)Standard binding that deals with deploying a webapp.
* `StandardStarter` (starting)Standard binding that deals with starting a webapp.
* `StandardStopper` (stopping)Standard binding that deals with stopping a webapp.
* `StandardUndeployer` (undeploying)Standard undeployer that deals with undeploying a webapp.
* `DebugBinding` (any specified)Attaches a binding and prints logging information of a context going through the specified binding target.
* `GlobalWebappConfigBinding` (deploying)Allows the user to override various settings of a webapp's context globally for all contexts.
+
[source, xml, subs="{sub-order}"]
----
<Call name="addLifeCycleBinding">
<Arg>
<New class="org.eclipse.jetty.deploy.bindings.GlobalWebappConfigBinding" >
<Set name="jettyXml">file://<Property name="jetty.home" default="." />/etc/global-webapp-context-config.xml</Set>
</New>
</Arg>
</Call>
----
* OrderedGroupBinding (any specified)Allows the user to set a specific order for bindings to process in a given binding target.

View File

@ -24,20 +24,17 @@ Create a file called `scratch.xml` in the `${jetty.base}/webapps` directory and
[source, xml, subs="{sub-order}"]
----
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
<Set name="contextPath">/scratch</Set>
<Set name="handler">
<New class="org.eclipse.jetty.server.handler.ResourceHandler">
   <Set name="resourceBase">/home/jesse/scratch</Set>
   <Set name="resourceBase">/home/scratch</Set>
<Set name="directoriesListed">true</Set>
</New>
</Set>
</Configure>
----
This is a very basic setup for serving static files.