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
(New page: {{Jetty Feature | 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...)
 
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/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]].
 
| 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 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:
Line 25: Line 25:
 
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 '''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 '''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 '''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.
  
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.
+
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.
  
 
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 '''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).
  
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.
+
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.
  
 
| category = [[Category:Jetty Feature]]
 
| category = [[Category:Jetty Feature]]
 
}}
 
}}

Revision as of 20:02, 18 June 2010



Introduction

The 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 Context Deployer.

Feature

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:

 <Call name="addLifeCycle">
   <Arg>
     <New class="org.mortbay.jetty.deployer.WebAppDeployer">
       <Set name="contexts"><Ref id="Contexts"/></Set>
       <Set name="webAppDir"><SystemProperty name="jetty.home" default<nowiki>=</nowiki>"."/>/webapps</Set>
       <Set name="parentLoaderPriority">false</Set>
       <Set name="extract">true</Set>
       <Set name="allowDuplicates">false</Set>
       <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default<nowiki>=</nowiki>"."/>/etc/webdefault.xml</Set>
     </New>
   </Arg>
 </Call>

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 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 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 parentLoaderPriority parameter is a boolean that selects of the standard java parent first delegation classloading will be used or the servlet specification webapp classloading priority.

If the extract parameter is true, any packed war or zip files will first be 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 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).

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

Back to the top