blob: 2ca5f48514e5cc8a43a7d14a5362cd3c35813f7f [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Deploying Web Applications</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><meta name="keywords" content="jetty, servlet, servlet-api, cometd, http, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty"><link rel="up" href="quick-start-getting-started.html" title="Chapter&nbsp;2.&nbsp;Using Jetty"><link rel="prev" href="quickstart-common-config.html" title="Common Jetty Configuration"><link rel="next" href="quick-start-configure.html" title="Chapter&nbsp;3.&nbsp;An Introduction to Jetty Configuration"><link xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" rel="shortcut icon" href="images/favicon.ico"><link rel="stylesheet" href="css/highlighter/foundation.css"><script src="js/highlight.pack.js"></script><script>
hljs.initHighlightingOnLoad();
</script><link type="text/css" rel="stylesheet" href="css/font-awesome/font-awesome.min.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><tr><td style="width: 25%"><a href="http://www.eclipse.org/jetty"><img src="images/jetty-header-logo.png" alt="Jetty Logo"></a><br><span style="font-size: small">
Version: 9.4.28-SNAPSHOT</span></td><td style="width: 50%"></td></tr></table><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Deploying Web Applications</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="quickstart-common-config.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;2.&nbsp;Using Jetty<br><a accesskey="p" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="quick-start-configure.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr></table><hr></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="jetty-callout"><h5 class="callout"><a href="http://www.webtide.com/">Contact the core Jetty developers at
<span class="website">www.webtide.com</span></a></h5><p>
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ...
scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="quickstart-deploying-webapps"></a>Deploying Web Applications</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="quickstart-deploying-webapps.html#_jetty_demonstration_web_applications">Jetty Demonstration Web Applications</a></span></dt></dl></div><p>Jetty server instances that configure the deploy module will have a web application deployer that <a class="link" href="hot-deployment.html" title="Hot Deployment">hot deploys</a> files found in the <code class="literal">webapps</code> directory.
Standard WAR files and Jetty configuration files that are placed in the <code class="literal">webapps</code> directory are hot deployed to the server with the following conventions:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">A directory called <code class="literal">example/</code> is deployed as a standard web application if it contains a <code class="literal">WEB-INF/</code> subdirectory, otherwise it is deployed as context of static content.
The context path is <code class="literal">/example</code> (that is, <code class="literal">http://localhost:8080/example/</code>) unless the base name is ROOT (case insensitive), in which case the context path is /.
If the directory name ends with ".d" it is ignored (but may be used by explicit configuration).</li><li class="listitem">A file called <code class="literal">example.war</code> is deployed as a standard web application with the context path <code class="literal">/example</code> (that is,
<code class="literal">http://localhost:8080/example/</code>).
If the base name is <code class="literal">ROOT</code> (case insensitive), the context path is <code class="literal">/</code>.
If <code class="literal">example.war</code> and <code class="literal">example/</code> exist, only the WAR is deployed (which may use the directory as an unpack location).</li><li class="listitem">An XML file like <code class="literal">example.xml</code> is deployed as a context whose configuration is defined by the XML.
The configuration itself must set the context path.
If <code class="literal">example.xml</code> and <code class="literal">example.war</code> exists, only the XML is deployed (which may use the WAR in its configuration).</li></ul></div><p>If you have a standard web application, you can hot deploy it into Jetty by copying it into the <code class="literal">webapps</code> directory.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_jetty_demonstration_web_applications"></a>Jetty Demonstration Web Applications</h3></div></div></div><p>The demo-base/webapps directory contains the following deployable and auxiliary files:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">ROOT/</code></span></dt><dd>A directory of static content that is deployed to the root context / due to it&#8217;s name.
Contains the Jetty demo welcome page.</dd><dt><span class="term"><code class="literal">test.d</code></span></dt><dd>A directory containing additional configuration files used by <code class="literal">test.xml</code> to inject extra configuration into <code class="literal">test.war</code>.</dd><dt><span class="term"><code class="literal">test.xml</code></span></dt><dd>A context configuration file that configures and deploys <code class="literal">test.war.</code>
The additional configuration includes the context path as well as setting additional descriptors found in the <code class="literal">test.d</code> directory.</dd><dt><span class="term"><code class="literal">test.war</code></span></dt><dd>The demonstration web application that is configured and deployed by <code class="literal">test.xml</code>.</dd><dt><span class="term"><code class="literal">async-rest.war</code></span></dt><dd>A web application demonstration of asynchronous REST to eBay, automatically deployed to /async-rest based on the file name.</dd><dt><span class="term"><code class="literal">test-jaas.war</code></span></dt><dd>A demonstration web application utilizing <a class="link" href="jaas-support.html" title="JAAS Support">JAAS</a> for authentication.</dd><dt><span class="term"><code class="literal">test-jaas.xml</code></span></dt><dd>A context configuration file that configures <code class="literal">test-jaas.war</code>.
Additional configuration includes setting up the <a class="link" href="configuring-security.html#configuring-login-service" title="Configuring a LoginService">LoginService</a> for authentication and authorization.</dd><dt><span class="term"><code class="literal">test-jndi.war</code></span></dt><dd>A demonstration web application showing the use of <a class="link" href="jndi.html" title="Chapter&nbsp;12.&nbsp;Configuring JNDI">JNDI</a>.</dd><dt><span class="term"><code class="literal">test-jndi.xml</code></span></dt><dd>A context configuration file that configures <code class="literal">test-jndi.war</code>.
Additional configuration includes defining objects in the naming space that can be referenced from the webapp.</dd><dt><span class="term"><code class="literal">test-spec.war</code></span></dt><dd>A demonstration web application that shows the use of annotations, fragments, <code class="literal">ServletContainerInitializers</code> and other Servlet Specification 3.0/3.1 features.</dd><dt><span class="term"><code class="literal">test-spec.xml</code></span></dt><dd>A context configuration file that configures <code class="literal">test-spec.war</code>.
Additional configuration includes setting up some objects in the naming space that can be referenced by annotations.</dd><dt><span class="term"><code class="literal">javadoc-proxy.war</code></span></dt><dd>A demonstration web application that uses a transparent proxy to serve the Jetty source <a class="link" href="http://www.eclipse.org/jetty/javadoc/9.4.28-SNAPSHOT/" target="_top">Javadoc</a> from the <a class="link" href="http://www.eclipse.org/jetty" target="_top">Eclipse Jetty website</a>.</dd><dt><span class="term"><code class="literal">example-moved.xml</code></span></dt><dd>A demonstration context configuration file that shows how to use the <a class="link" href="moved-context-handler.html" title="Moved Context Handler"><code class="literal">MovedContextHandler</code></a> to redirect from one path to another.</dd></dl></div></div></div><script type="text/javascript">
SyntaxHighlighter.all()
</script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="quickstart-common-config.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="quick-start-getting-started.html"><i class="fa fa-chevron-up" aria-hidden="true"></i> Top</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="quick-start-configure.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Common Jetty Configuration&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;3.&nbsp;An Introduction to Jetty Configuration</td></tr></table></div><p xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><div class="jetty-callout">
See an error or something missing?
<span class="callout"><a href="http://github.com/eclipse/jetty.project">Contribute to this documentation at
<span class="website"><i class="fa fa-github" aria-hidden="true"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2020-03-10)</i></span></div></p></body></html>