Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Feature/WebAppProvider"

< Jetty‎ | Feature
m
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Jetty Feature
 
{{Jetty Feature
 
| introduction =
 
| introduction =
The [http://dev.eclipse.org/viewcvs/index.cgi/jetty/trunk/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppDeployer.java?root=RT_JETTY&view=markup WebAppDeployer] is for static deployment of standard WAR files and webapps with little or no Jetty specific customization. For hot deployment of customized contexts, use the [[Jetty/Feature/ContextDeployer|Context Deployer]].
+
The [http://dev.eclipse.org/viewcvs/viewvc.cgi/jetty/trunk/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java?view=markup&root=RT_JETTY WebAppProvider] is for static deployment of standard WAR files and webapps with little or no Jetty-specific customization. For hot deployment of customized contexts, use the [[Jetty/Feature/ContextDeployer|Context Provider]].
 
| body =  
 
| body =  
The basic operation of WebAppDeployer is to scan a directory at startup for WAR files or webapp directories and the deploy the webapplications found. Typically this is done from a jetty.xml file:
+
The basic operation of WebAppProvider is to scan a directory at startup for WAR files or webapp directories and to deploy the web applications found. Typically this is done from a <tt>jetty.xml</tt> style file; in the jetty distribution the name of this file is <tt>jetty-webapps.xml</tt>:
 
<source lang="xml">
 
<source lang="xml">
  <Call name="addLifeCycle">
+
  <Configure id="Server" class="org.eclipse.jetty.server.Server">
  <Arg>
+
    <Ref id="DeploymentManager">
    <New class="org.mortbay.jetty.deployer.WebAppDeployer">
+
          <Call id="webappprovider" name="addAppProvider">
      <Set name="contexts"><Ref id="Contexts"/></Set>
+
            <Arg>
      <Set name="webAppDir"><SystemProperty name="jetty.home" default<nowiki>=</nowiki>"."/>/webapps</Set>
+
              <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
      <Set name="parentLoaderPriority">false</Set>
+
                <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
      <Set name="extract">true</Set>
+
                <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
      <Set name="allowDuplicates">false</Set>
+
                <Set name="scanInterval">1</Set>
      <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default<nowiki>=</nowiki>"."/>/etc/webdefault.xml</Set>
+
                <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
    </New>
+
<Set name="extractWars">true</Set>
  </Arg>
+
              </New>
</Call>
+
            </Arg>
 +
          </Call>
 +
    </Ref>
 +
</Configure>
 
</source>
 
</source>
  
The WebAppDeployer is added to the server as a LifeCycle. This simply means that the deployer will be started and stopped with the server. Ie when server.start() is called, then start will also be called on the deployer.
+
The WebAppProvider is added to the server as a LifeCycle. This simply means that the deployer starts and stops with the server, that is, when <tt>server.start()</tt> is called, then <tt>start</tt> is also called on the deployer.
  
The '''context''' passed in is a reference to a HandlerContainer in which the discovered webapps will be deployed. This is normally an instance of ContextHandlerCollection.
+
The ''context'' passed in is a reference to a HandlerContainer in which the discovered webapps are deployed. This is normally an instance of ContextHandlerCollection.
  
The '''webAppDir''' is a file path or URL to the directory to scan for webapplications. Zip files ending with .war or .zip are deployed. Directories not call CVS are also deployed. The basename of the war (eg foo from foo.war) or the directory name are used as the context path of the discovered webapps, unless the name is "root", in which case the context path of / is used.
+
The ''contextXmlDir'' points to a directory like that the ContextProvider uses. When you use this option the WebappProvider checks any webapp or WAR files in the monitored directory for an associated context file. If it finds one, it defers to the ContextProvider to deploy the webapp.  If it does not find a context file, the WebAppProvider deploys the webapp.
  
The '''parentLoaderPriority''' parameter is a boolean that selects of the standard java parent first delegation [[Jetty/Feature/Classloading|classloading]] will be used or the servlet specification webapp [[Jetty/Feature/Classloading|classloading]] priority.
+
The ''monitoredDirName'' is a file path or URL to the directory to scan for web applications. Zip files ending with .war or .zip are deployed. Directories not called CVS are also deployed. The basename of the WAR (for example, ''foo'' from foo.war) or the directory name are used as the context path of the discovered webapps, unless the name is "root", in which case the context path of / is used.
  
If the '''extract''' parameter is true, any packed war or zip files will first be extracted to a [[Jetty/Feature/Temporary Directories| temporary directory]] before being deployed. This is advisable if there are uncompiled JSPs in the web apps.
+
The ''parentLoaderPriority'' parameter is a boolean that selects whether the standard Java parent first delegation [[Jetty/Reference/Jetty_Classloading|classloading]] will be used or the servlet specification webapp [[Jetty/Reference/Jetty_Classloading]] priority.  
  
If the '''allowDuplicates''' parameter is false, the discovered webapps will be checked against existing deployed webapps and will not be deployed if the same context path or war files is already deployed (perhaps by another deployer).
+
If the ''extract'' parameter is true, any packed WAR or zip files are first extracted to a [[Jetty/Reference/Temporary_Directories|temporary directory]] before being deployed. This is advisable if there are uncompiled JSPs in the web apps.
  
The '''defaultsDescriptor''' parameter allows an alternative [[JETTY/Reference/webdefault.xml|webdefault.xml]] config file to be set on the discovered web applications. The [[Jetty/Reference/webdefault.xml|webdefault.xml]] file is used to control the configuration of the JSP and Default servlets.
+
If the ''allowDuplicates'' parameter is false, the discovered webapps are checked against existing deployed webapps and are not deployed if the same context path or WAR file is already deployed (perhaps by another deployer).
 +
 
 +
The ''defaultsDescriptor'' parameter allows an alternative webdefault.xml config file to be set on the discovered web applications. The [[Jetty/Reference/webdefault.xml|webdefault.xml]] file controls the configuration of the JSP and Default servlets.
  
 
| category = [[Category:Jetty Feature]]
 
| category = [[Category:Jetty Feature]]
 
}}
 
}}

Latest revision as of 16:56, 10 June 2011



Introduction

The WebAppProvider is for static deployment of standard WAR files and webapps with little or no Jetty-specific customization. For hot deployment of customized contexts, use the Context Provider.

Feature

The basic operation of WebAppProvider is to scan a directory at startup for WAR files or webapp directories and to deploy the web applications found. Typically this is done from a jetty.xml style file; in the jetty distribution the name of this file is jetty-webapps.xml:

 <Configure id="Server" class="org.eclipse.jetty.server.Server">
    <Ref id="DeploymentManager">
          <Call id="webappprovider" name="addAppProvider">
            <Arg>
              <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
                <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
                <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
                <Set name="scanInterval">1</Set>
                <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
		<Set name="extractWars">true</Set>
              </New>
            </Arg>
          </Call>
    </Ref>
</Configure>

The WebAppProvider is added to the server as a LifeCycle. This simply means that the deployer starts and stops with the server, that is, when server.start() is called, then start is also called on the deployer.

The context passed in is a reference to a HandlerContainer in which the discovered webapps are deployed. This is normally an instance of ContextHandlerCollection.

The contextXmlDir points to a directory like that the ContextProvider uses. When you use this option the WebappProvider checks any webapp or WAR files in the monitored directory for an associated context file. If it finds one, it defers to the ContextProvider to deploy the webapp. If it does not find a context file, the WebAppProvider deploys the webapp.

The monitoredDirName is a file path or URL to the directory to scan for web applications. Zip files ending with .war or .zip are deployed. Directories not called CVS are also deployed. The basename of the WAR (for example, foo from foo.war) or the directory name are used as the context path of the discovered webapps, unless the name is "root", in which case the context path of / is used.

The parentLoaderPriority parameter is a boolean that selects whether the standard Java parent first delegation classloading will be used or the servlet specification webapp Jetty/Reference/Jetty_Classloading priority.

If the extract parameter is true, any packed WAR or zip files are first extracted to a temporary directory before being deployed. This is advisable if there are uncompiled JSPs in the web apps.

If the allowDuplicates parameter is false, the discovered webapps are checked against existing deployed webapps and are not deployed if the same context path or WAR file is already deployed (perhaps by another deployer).

The defaultsDescriptor parameter allows an alternative webdefault.xml config file to be set on the discovered web applications. The webdefault.xml file controls the configuration of the JSP and Default servlets.

Back to the top