Message-ID: <598975917.2271.1369287948806.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2270_936357419.1369287948806" ------=_Part_2270_936357419.1369287948806 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
The ContextDeplo= yer may be used to (hot)deploy an arbitrary Context or Web Application = with Jetty specific configuration. To statically deploy only standard web a= pplications at startup, use the W= ebAppDeployer.
Typically a ContextDeployer is defined in a jetty.xml file:
The ContextDeployer will scan the configurationDir dire=
ctory at intervals of scanInterval seconds for xml descrip=
tors that define contexts. Any contexts found are deployed to the passed
contexts reference to a HandlerContainer (this is normally a=
n instance of ContextHandlerCollection).
The deployment descriptors are in jetty xml format and define and configure individual contexts. A= minimal example is:
This example creates an instance of org.mortbay.jetty.webapp.WebAppContext and sets the
The ContextDeployer is added to the server as a LifeCycle. This simply m= eans 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.<= /p>
The ContextDeployer can automatically do property substitution on the co=
ntext files that it deploys. You define a ConfigurationManager that manages=
the properties and pass this into the ContextDeployer. There is currently =
one implementation of the ConfigurationManager, and that is the
ortbay.jetty.deployer.FileConfigurationManager that reads a properti=
es file and makes available the property values to the ContextDeployer. Her=
e's how you would configure the ContextDeployer:
Here's an example of the contents of the foo.properties file:
Here's how you would use this in a context xml file:
Because the class of the context is defined in the Configure clause, any= type of ContextHandl= er may be deployed with this mechanism, included base ContextHandlers, servlet Contexts, WebAppContexts or any class derived from= them.
If the scan interval is non-zero, the configuration directory is scanned= at that interval (in seconds) for changes to the deployment descriptors. = If a descriptor is added to the directory, the new context will be deployed= . If a descriptor is touched/updated then it's context will be stopped, rec= onfigured and redeployed. If a descriptor is removed, then it's context wi= ll be stopped and removed from the server.
If the scan interval is zero, then the directory is only scanned at star= tup.
This mechanism allows the most of the API available on ContextHandler or its derived c= lasses to be called to configure the web application. Useful things to conf= igure include: