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/Howto/Deploy Web Applications

< Jetty‎ | Howto
Revision as of 14:59, 28 April 2011 by Boulay.intalio.com (Talk | contribs)



Introduction

Jetty can deploy web applications as WAR files (packed or unpacked), as provided or with overridden configuration, and with static or hot deployment.

Deploying Webapps

Jetty scans its $JETTY_HOME/webapps directory at startup for web applications to deploy:

  • It deploys the file foo.war as a webapp at context /foo.
  • It deploys the directory foo/ at context /foo. If the directory has a WEB-INF subdirectory, Jetty treats it as a servlet webapp, otherwise Jetty serves it only as static content.
  • If both a foo.war and a foo/ directory exist, Jetty uses the one with the most recent last-modified date.
  • If the webapp is called root.war or the directory is called root/ then Jetty deploys it at the / context.
  • If the contextXmlDir option is used and a foo.xml file exists in that dir, the WebAppProvider defers to the Contexts Provider for actual webapp deployment.

Formerly the WebAppDeployer class controlled webapp deployment. With Jetty version 7.0.2 and later, the WebAppProvider of the DeploymentManager controls web app deployment..

See also older (but mostly relevant) Jetty-6 WebAppDeployer documentation.

Deploying Contexts

Jetty scans the $JETTY_HOME/contexts directory at runtime for context.xml files that describe either:

  • a standard WAR file (or directory), plus additional configuration.
  • a custom Jetty context.

Formerly the ContextDeployer class contolled contexts deployment. With Jetty version 7.0.2 and later, the ContextProvider of the DeploymentManager controls contexts deployment.

See also older (but mostly relevant) Jetty-6 ContextDeployer documentation.

Jetty Maven Plugin

If you develop your web application as a Maven project, you can deploy it in Jetty with "mvn jetty:run" using the Jetty Maven Plugin.

Maven lets you build your web applications by overlaying on other template web applications (for example, Cometd) and manages the transitive dependencies needed to populate WEB-INF/lib.

OSGi web application bundle

TBD

Using Embedded Jetty

You can also deploy web applications into embedded Jetty, either via direct configuration or via configuration of a deployer. For an example see the Embedding Jetty Tutorial.

Back to the top