Skip to main content

Notice: This Wiki is now read only and edits are no longer 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/Hot Deployment"

< Jetty‎ | Feature
Line 5: Line 5:
 
| body =
 
| body =
  
The documentation for Deployment Manager is forthcoming.
+
The deployment manager is an more state oriented mechanism suitable for developers and embedded users to customize to a variety of use cases.  Below is an example of the jetty.xml that is used to create the basic deployment manager which is then used to plug in the ContextProvider and the WebAppProvider that back the Hot Deployment mechanism.  Also provided in the example is how to go about adding in another node to the deployment state, in this case a debug binding.  In the jetty distribution this xml can be found in the jetty-deploy.xml file which coupled with the jetty-contexts.xml and jetty-webapps.xml files comprise the stock jetty hot deployment mechanism.
 +
 
 +
<source lang="xml">
 +
<Configure id="Server" class="org.eclipse.jetty.server.Server">
 +
 
 +
    <Call name="addBean">
 +
      <Arg>
 +
        <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
 +
          <Set name="contexts">
 +
            <Ref id="Contexts" />
 +
          </Set>
 +
          <Call name="setContextAttribute">
 +
            <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
 +
            <Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
 +
          </Call>
 +
         
 +
         
 +
          <!-- Add a customize step to the deployment lifecycle -->
 +
          <!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class
 +
          <Call name="insertLifeCycleNode">
 +
            <Arg>deployed</Arg>
 +
            <Arg>starting</Arg>
 +
            <Arg>customise</Arg>
 +
          </Call>
 +
          <Call name="addLifeCycleBinding">
 +
            <Arg>
 +
              <New class="org.eclipse.jetty.deploy.bindings.DebugBinding">
 +
                <Arg>customise</Arg>
 +
              </New>
 +
            </Arg>
 +
          </Call>
 +
          -->
 +
         
 +
        </New>
 +
      </Arg>
 +
    </Call>
 +
</Configure>
 +
</source>
  
 
| more =
 
| more =
Previously, this feature has been implemented via ContextDeployer. Context Deployer information is still available [[Jetty/Feature/ContextDeployer|here]]. WebApp Deployer information is still available [[Jetty/Feature/WebAppDeployer|here]].
+
Previously, this feature has been implemented via ContextDeployer and WebappDeployer which have both been deprecated. Context Provider information is now available [[Jetty/Feature/ContextDeployer|here]]. WebApp Provider information is available [[Jetty/Feature/WebAppDeployer|here]].
 
}}
 
}}

Revision as of 16:18, 27 April 2011



Introduction

Jetty provides capability to deploy an arbitrary context or web application by monitoring a directory for changes. If a web application or a context descriptor is added to the directory, a new context will be deployed. If a context descriptor is touched/updated then it's context will be stopped, reconfigured and redeployed. If a context descriptor is removed, then it's context will be stopped and removed from the server.

Feature

The deployment manager is an more state oriented mechanism suitable for developers and embedded users to customize to a variety of use cases. Below is an example of the jetty.xml that is used to create the basic deployment manager which is then used to plug in the ContextProvider and the WebAppProvider that back the Hot Deployment mechanism. Also provided in the example is how to go about adding in another node to the deployment state, in this case a debug binding. In the jetty distribution this xml can be found in the jetty-deploy.xml file which coupled with the jetty-contexts.xml and jetty-webapps.xml files comprise the stock jetty hot deployment mechanism.

<Configure id="Server" class="org.eclipse.jetty.server.Server">
 
    <Call name="addBean">
      <Arg>
        <New id="DeploymentManager" class="org.eclipse.jetty.deploy.DeploymentManager">
          <Set name="contexts">
            <Ref id="Contexts" />
          </Set>
          <Call name="setContextAttribute">
            <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
            <Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</Arg>
          </Call>
 
 
          <!-- Add a customize step to the deployment lifecycle -->
          <!-- uncomment and replace DebugBinding with your extended AppLifeCycle.Binding class 
          <Call name="insertLifeCycleNode">
            <Arg>deployed</Arg>
            <Arg>starting</Arg>
            <Arg>customise</Arg>
          </Call>
          <Call name="addLifeCycleBinding">
            <Arg>
              <New class="org.eclipse.jetty.deploy.bindings.DebugBinding">
                <Arg>customise</Arg>
              </New>
            </Arg>
          </Call>
          -->
 
        </New>
      </Arg>
    </Call>
</Configure>

Additional Resources

Previously, this feature has been implemented via ContextDeployer and WebappDeployer which have both been deprecated. Context Provider information is now available here. WebApp Provider information is available here.

Back to the top