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