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

Jetty/Feature/Deployment Manager



Introduction

Jetty provides capability to deploy an arbitrary context or web application. It begins by monitoring a directory for changes. If you add a web application or a context descriptor to the directory, the Deployment Manager (DM) deploys a new context. If you touch or update a context descriptor, the DM stops its context, reconfigures it, and redeploys it. If you remove a context descriptor, the DM stops its context and removes it from the server.

Feature

The Deployment Manager is the heart of the webapp deployment mechanism; it is responsible for the lifecycle of an application through the phases of deployment. In essence it is a graph pre-populated with standard edges/nodes. Alone these edges/nodes are useless, but Jetty has the ability to bind an implementation (of the DeployManager) to a specific node. There are four default bindings: deploying, starting, stopping, and undeploying. A fifth, the DebugBInding, is also provided, but is not a part of the standard process.

AppProviders create a way for (web)apps to enter the lifecycle. You can have as many AppProvider implementations as you like registered with the DM mechanism. By default Jetty provides two:

  • The ContextProvider finds and provides webapps based on the existence of context.xml files in the ${jetty.home}/contexts directory.
  • The WebAppProvider finds and provides webapps based on the existence of WAR files or webapp directories within the ${jetty.home}/webapps directory.

Activating both at the same time is possible, but can be confusing because you must take care to either keep both systems deploying mutually exclusive webapps, or align naming conventions of context.xml style files with WAR and webapp directories.

You can modify the lifecycle graph (the collection of edges and nodes) at startup. You can insert new edges and nodes where you choose, but doing so constitutes quite an advanced use. Normal use cases work well with the existing mechanism, although if there is a requirement to preprocess a webapp to scan for some metadata, or check for some external condition like database accessibility that a particular user installation is highly interested in, you might need to go this route. Regardless, only those working on advanced deployments–vetting content, or modifying webapps prior to deployment–should attempt to extend the DM in this way.

When an App Provider submits a new app to the lifecycle, it automatically enters the graph at Undeployed. It sends a request to the DM to move that app to Started state (the default behavior of Jetty atm). The DM finds the app at Undeployed, and performs a breadth-first search on the graph to discover how to get to Started. It finds the path .... Undeployed -> Deploying -> Deployed -> Starting -> Started. It executes each step of the path, and executes each binding at each step, stopping when it reaches the goal node, or if an exception is thrown.

Back to the top