刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 7 Configuration Reference (7.0.77) - The Host Container</title><meta name="author" content="Craig R. McClanahan"><meta name="author" content="Remy Maucherat"><meta name="author" content="Yoav Shapira"><style type="text/css" media="print">
|
| 2 | .noPrint {display: none;}
|
| 3 | td#mainBody {width: 100%;}
|
| 4 | </style><style type="text/css">
|
| 5 | code {background-color:rgb(224,255,255);padding:0 0.1em;}
|
| 6 | code.attributeName, code.propertyName {background-color:transparent;}
|
| 7 |
|
| 8 |
|
| 9 | table {
|
| 10 | border-collapse: collapse;
|
| 11 | text-align: left;
|
| 12 | }
|
| 13 | table *:not(table) {
|
| 14 | /* Prevent border-collapsing for table child elements like <div> */
|
| 15 | border-collapse: separate;
|
| 16 | }
|
| 17 |
|
| 18 | th {
|
| 19 | text-align: left;
|
| 20 | }
|
| 21 |
|
| 22 |
|
| 23 | div.codeBox pre code, code.attributeName, code.propertyName, code.noHighlight, .noHighlight code {
|
| 24 | background-color: transparent;
|
| 25 | }
|
| 26 | div.codeBox {
|
| 27 | overflow: auto;
|
| 28 | margin: 1em 0;
|
| 29 | }
|
| 30 | div.codeBox pre {
|
| 31 | margin: 0;
|
| 32 | padding: 4px;
|
| 33 | border: 1px solid #999;
|
| 34 | border-radius: 5px;
|
| 35 | background-color: #eff8ff;
|
| 36 | display: table; /* To prevent <pre>s from taking the complete available width. */
|
| 37 | /*
|
| 38 | When it is officially supported, use the following CSS instead of display: table
|
| 39 | to prevent big <pre>s from exceeding the browser window:
|
| 40 | max-width: available;
|
| 41 | width: min-content;
|
| 42 | */
|
| 43 | }
|
| 44 |
|
| 45 | div.codeBox pre.wrap {
|
| 46 | white-space: pre-wrap;
|
| 47 | }
|
| 48 |
|
| 49 |
|
| 50 | table.defaultTable tr, table.detail-table tr {
|
| 51 | border: 1px solid #CCC;
|
| 52 | }
|
| 53 |
|
| 54 | table.defaultTable tr:nth-child(even), table.detail-table tr:nth-child(even) {
|
| 55 | background-color: #FAFBFF;
|
| 56 | }
|
| 57 |
|
| 58 | table.defaultTable tr:nth-child(odd), table.detail-table tr:nth-child(odd) {
|
| 59 | background-color: #EEEFFF;
|
| 60 | }
|
| 61 |
|
| 62 | table.defaultTable th, table.detail-table th {
|
| 63 | background-color: #88b;
|
| 64 | color: #fff;
|
| 65 | }
|
| 66 |
|
| 67 | table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
|
| 68 | padding: 5px 8px;
|
| 69 | }
|
| 70 |
|
| 71 |
|
| 72 | p.notice {
|
| 73 | border: 1px solid rgb(255, 0, 0);
|
| 74 | background-color: rgb(238, 238, 238);
|
| 75 | color: rgb(0, 51, 102);
|
| 76 | padding: 0.5em;
|
| 77 | margin: 1em 2em 1em 1em;
|
| 78 | }
|
| 79 | </style></head><body bgcolor="#ffffff" text="#000000" link="#525D76" alink="#525D76" vlink="#525D76"><table border="0" width="100%" cellspacing="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img src="../images/tomcat.gif" align="right" alt="
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 80 | The Apache Tomcat Servlet/JSP Container
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 81 | " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 7</font></h1><font face="arial,helvetica,sanserif">Version 7.0.77, Mar 28 2017</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="../images/asf-logo.svg" align="right" alt="Apache Logo" border="0" style="width: 266px;height: 83px;"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap class="noPrint"><p><strong>Links</strong></p><ul><li><a href="../index.html">Docs Home</a></li><li><a href="index.html">Config Ref. Home</a></li><li><a href="http://wiki.apache.org/tomcat/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul><p><strong>Top Level Elements</strong></p><ul><li><a href="server.html">Server</a></li><li><a href="service.html">Service</a></li></ul><p><strong>Executors</strong></p><ul><li><a href="executor.html">Executor</a></li></ul><p><strong>Connectors</strong></p><ul><li><a href="http.html">HTTP</a></li><li><a href="ajp.html">AJP</a></li></ul><p><strong>Containers</strong></p><ul><li><a href="context.html">Context</a></li><li><a href="engine.html">Engine</a></li><li><a href="host.html">Host</a></li><li><a href="cluster.html">Cluster</a></li></ul><p><strong>Nested Components</strong></p><ul><li><a href="globalresources.html">Global Resources</a></li><li><a href="jar-scanner.html">JarScanner</a></li><li><a href="listeners.html">Listeners</a></li><li><a href="loader.html">Loader</a></li><li><a href="manager.html">Manager</a></li><li><a href="realm.html">Realm</a></li><li><a href="resources.html">Resources</a></li><li><a href="sessionidgenerator.html">SessionIdGenerator</a></li><li><a href="valve.html">Valve</a></li></ul><p><strong>Cluster Elements</strong></p><ul><li><a href="cluster.html">Cluster</a></li><li><a href="cluster-manager.html">Manager</a></li><li><a href="cluster-channel.html">Channel</a></li><li><a href="cluster-membership.html">Channel/Membership</a></li><li><a href="cluster-sender.html">Channel/Sender</a></li><li><a href="cluster-receiver.html">Channel/Receiver</a></li><li><a href="cluster-interceptor.html">Channel/Interceptor</a></li><li><a href="cluster-valve.html">Valve</a></li><li><a href="cluster-deployer.html">Deployer</a></li><li><a href="cluster-listener.html">ClusterListener</a></li></ul><p><strong>web.xml</strong></p><ul><li><a href="filter.html">Filter</a></li></ul><p><strong>Other</strong></p><ul><li><a href="systemprops.html">System properties</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>The Host Container</h1><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Table of Contents"><!--()--></a><a name="Table_of_Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 82 | <ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Attributes">Attributes</a><ol><li><a href="#Common_Attributes">Common Attributes</a></li><li><a href="#Standard_Implementation">Standard Implementation</a></li></ol></li><li><a href="#Nested_Components">Nested Components</a></li><li><a href="#Special_Features">Special Features</a><ol><li><a href="#Logging">Logging</a></li><li><a href="#Access_Logs">Access Logs</a></li><li><a href="#Automatic_Application_Deployment">Automatic Application Deployment</a></li><li><a href="#Host_Name_Aliases">Host Name Aliases</a></li><li><a href="#Lifecycle_Listeners">Lifecycle Listeners</a></li><li><a href="#Request_Filters">Request Filters</a></li><li><a href="#Single_Sign_On">Single Sign On</a></li><li><a href="#User_Web_Applications">User Web Applications</a></li></ol></li></ul>
|
| 83 | </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
|
| 84 |
|
| 85 | <p>The <strong>Host</strong> element represents a <em>virtual host</em>,
|
| 86 | which is an association of a network name for a server (such as
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 87 | "www.mycompany.com") with the particular server on which Tomcat is running.
|
| 88 | For clients to be able to connect to a Tomcat server using its network name,
|
| 89 | this name must be registered in the <em>Domain Name Service</em> (DNS) server
|
| 90 | that manages the Internet domain you belong to - contact your Network
|
| 91 | Administrator for more information.</p>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 92 |
|
| 93 | <p>In many cases, System Administrators wish to associate more than
|
| 94 | one network name (such as <code>www.mycompany.com</code> and
|
| 95 | <code>company.com</code>) with the same virtual host and applications.
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 96 | This can be accomplished using the <a href="#Host_Name_Aliases">Host
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 97 | Name Aliases</a> feature discussed below.</p>
|
| 98 |
|
| 99 | <p>One or more <strong>Host</strong> elements are nested inside an
|
| 100 | <a href="engine.html">Engine</a> element. Inside the Host element, you
|
| 101 | can nest <a href="context.html">Context</a> elements for the web
|
| 102 | applications associated with this virtual host. Exactly one of the Hosts
|
| 103 | associated with each Engine MUST have a name matching the
|
| 104 | <code>defaultHost</code> attribute of that Engine.</p>
|
| 105 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 106 | <p>Clients normally use host names to identify the server they wish to connect
|
| 107 | to. This host name is also included in the HTTP request headers. Tomcat
|
| 108 | extracts the host name from the HTTP headers and looks for a
|
| 109 | <strong>Host</strong> with a matching name. If no match is found, the request
|
| 110 | is routed to the default host. The name of the default host does not have to
|
| 111 | match a DNS name (although it can) since any request where the DNS name does
|
| 112 | not match the name of a <strong>Host</strong> element will be routed to the
|
| 113 | default host.</p>
|
| 114 |
|
| 115 | <p><em>The description below uses the variable name $CATALINA_BASE to refer the
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 116 | base directory against which most relative paths are resolved. If you have
|
| 117 | not configured Tomcat for multiple instances by setting a CATALINA_BASE
|
| 118 | directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 119 | the directory into which you have installed Tomcat.</em></p>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 120 |
|
| 121 | </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Attributes"><strong>Attributes</strong></a></font></td></tr><tr><td><blockquote>
|
| 122 |
|
| 123 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Common Attributes"><!--()--></a><a name="Common_Attributes"><strong>Common Attributes</strong></a></font></td></tr><tr><td><blockquote>
|
| 124 |
|
| 125 | <p>All implementations of <strong>Host</strong>
|
| 126 | support the following attributes:</p>
|
| 127 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 128 | <table border="1" cellpadding="5"><tr><th width="15%" bgcolor="#023264"><font color="#ffffff">Attribute</font></th><th width="85%" bgcolor="#023264"><font color="#ffffff">Description</font></th></tr><tr><td align="left" valign="center"><strong><code class="attributeName">appBase</code></strong></td><td align="left" valign="center">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 129 | <p>The <em>Application Base</em> directory for this virtual host.
|
| 130 | This is the pathname of a directory that may contain web applications
|
| 131 | to be deployed on this virtual host. You may specify an
|
| 132 | absolute pathname, or a pathname that is relative to the
|
| 133 | <code>$CATALINA_BASE</code> directory. See
|
| 134 | <a href="#Automatic_Application_Deployment">Automatic Application
|
| 135 | Deployment</a> for more information on automatic recognition and
|
| 136 | deployment of web applications. If not specified, the default of
|
| 137 | <code>webapps</code> will be used.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 138 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">xmlBase</code></td><td align="left" valign="center">
|
| 139 | <p>The <em>XML Base</em> directory for this virtual host.
|
| 140 | This is the pathname of a directory that may contain context XML
|
| 141 | descriptors to be deployed on this virtual host. You may specify an
|
| 142 | absolute pathname for this directory, or a pathname that is relative
|
| 143 | to the <code>$CATALINA_BASE</code> directory. See
|
| 144 | <a href="#Automatic_Application_Deployment">Automatic Application
|
| 145 | Deployment</a> for more information on automatic recognition and
|
| 146 | deployment of web applications. If not specified the default of
|
| 147 | <code>conf/<engine_name>/<host_name></code> will be used.</p>
|
| 148 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">createDirs</code></td><td align="left" valign="center">
|
| 149 | <p>If set to true, Tomcat will attempt to create the directories defined
|
| 150 | by the attributes <code>appBase</code> and <code>xmlBase</code> during
|
| 151 | the startup phase. The default value is <code>true</code>. If set to
|
| 152 | true, and directory creation fails, an error message will be printed out
|
| 153 | but will not halt the startup sequence.</p>
|
| 154 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">autoDeploy</code></td><td align="left" valign="center">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 155 | <p>This flag value indicates if Tomcat should check periodically for new
|
| 156 | or updated web applications while Tomcat is running. If true, Tomcat
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 157 | periodically checks the <code>appBase</code> and <code>xmlBase</code>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 158 | directories and deploys any new web applications or context XML
|
| 159 | descriptors found. Updated web applications or context XML descriptors
|
| 160 | will trigger a reload of the web application. The flag's value defaults
|
| 161 | to true. See
|
| 162 | <a href="#Automatic_Application_Deployment">Automatic Application
|
| 163 | Deployment</a> for more information.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 164 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">backgroundProcessorDelay</code></td><td align="left" valign="center">
|
| 165 | <p>This value represents the delay in seconds between the
|
| 166 | invocation of the backgroundProcess method on this host and
|
| 167 | its child containers, including all contexts.
|
| 168 | Child containers will not be invoked if their delay value is not
|
| 169 | negative (which would mean they are using their own processing
|
| 170 | thread). Setting this to a positive value will cause
|
| 171 | a thread to be spawn. After waiting the specified amount of time,
|
| 172 | the thread will invoke the backgroundProcess method on this host
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 173 | and all its child containers. A host will use background processing to
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 174 | perform live web application deployment related tasks. If not
|
| 175 | specified, the default value for this attribute is -1, which means
|
| 176 | the host will rely on the background processing thread of its parent
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 177 | engine.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 178 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">className</code></td><td align="left" valign="center">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 179 | <p>Java class name of the implementation to use. This class must
|
| 180 | implement the <code>org.apache.catalina.Host</code> interface.
|
| 181 | If not specified, the standard value (defined below) will be used.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 182 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">deployIgnore</code></td><td align="left" valign="center">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 183 | <p>A regular expression defining paths to ignore when
|
| 184 | <code>autoDeploy</code> and <code>deployOnStartup</code> are set. This
|
| 185 | allows you to keep your configuration in a version control system, for
|
| 186 | example, and not deploy a .svn or CVS folder that happens to be in the
|
| 187 | <code>appBase</code>.</p>
|
| 188 | <p>This regular expression is relative to <code>appBase</code>. It is
|
| 189 | also <em>anchored</em>, meaning the match is performed against the
|
| 190 | entire file/directory name. So, <code>foo</code> matches only a file or
|
| 191 | directory named <code>foo</code> but not <code>foo.war</code>,
|
| 192 | <code>foobar</code>, or <code>myfooapp</code>. To match anything with
|
| 193 | "foo", you could use <code>.*foo.*</code>.</p>
|
| 194 | <p>See <a href="#Automatic_Application_Deployment">Automatic Application
|
| 195 | Deployment</a> for more information.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 196 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">deployOnStartup</code></td><td align="left" valign="center">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 197 | <p>This flag value indicates if web applications from this host should
|
| 198 | be automatically deployed when Tomcat starts. The flag's value defaults
|
| 199 | to true. See
|
| 200 | <a href="#Automatic_Application_Deployment">Automatic Application
|
| 201 | Deployment</a> for more information.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 202 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">failCtxIfServletStartFails</code></td><td align="left" valign="center">
|
| 203 | <p>Set to <code>true</code> to have each child contexts fail its startup
|
| 204 | if any of its servlet that has load-on-startup >=0 fails its own
|
| 205 | startup.</p>
|
| 206 | <p>Each child context may override this attribute.</p>
|
| 207 | <p>If not specified, the default value of <code>false</code> is
|
| 208 | used.</p>
|
| 209 | </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">name</code></strong></td><td align="left" valign="center">
|
| 210 | <p>Usually the network name of this virtual host, as registered in your
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 211 | <em>Domain Name Service</em> server. Regardless of the case used to
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 212 | specify the host name, Tomcat will convert it to lower case internally.
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 213 | One of the Hosts nested within an <a href="engine.html">Engine</a> MUST
|
| 214 | have a name that matches the <code>defaultHost</code> setting for that
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 215 | Engine. See <a href="#Host_Name_Aliases">Host Name Aliases</a> for
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 216 | information on how to assign more than one network name to the same
|
| 217 | virtual host.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 218 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">startStopThreads</code></td><td align="left" valign="center">
|
| 219 | <p>The number of threads this <strong>Host</strong> will use to start
|
| 220 | child <a href="context.html">Context</a> elements in parallel. The same
|
| 221 | thread pool will be used to deploy new
|
| 222 | <a href="context.html">Context</a>s if automatic deployment is being
|
| 223 | used. The special value of 0 will result in the value of
|
| 224 | <code>Runtime.getRuntime().availableProcessors()</code> being used.
|
| 225 | Negative values will result in
|
| 226 | <code>Runtime.getRuntime().availableProcessors() + value</code> being
|
| 227 | used unless this is less than 1 in which case 1 thread will be used. If
|
| 228 | not specified, the default value of 1 will be used.</p>
|
| 229 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">undeployOldVersions</code></td><td align="left" valign="center">
|
| 230 | <p>This flag determines if Tomcat, as part of the auto deployment
|
| 231 | process, will check for old, unused versions of web applications
|
| 232 | deployed using parallel deployment and, if any are found, remove them.
|
| 233 | This flag only applies if <code>autoDeploy</code> is true. If not
|
| 234 | specified the default value of false will be used.</p>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 235 | </td></tr></table>
|
| 236 |
|
| 237 | </blockquote></td></tr></table>
|
| 238 |
|
| 239 |
|
| 240 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Standard Implementation"><!--()--></a><a name="Standard_Implementation"><strong>Standard Implementation</strong></a></font></td></tr><tr><td><blockquote>
|
| 241 |
|
| 242 | <p>The standard implementation of <strong>Host</strong> is
|
| 243 | <strong>org.apache.catalina.core.StandardHost</strong>.
|
| 244 | It supports the following additional attributes (in addition to the
|
| 245 | common attributes listed above):</p>
|
| 246 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 247 | <table border="1" cellpadding="5"><tr><th width="15%" bgcolor="#023264"><font color="#ffffff">Attribute</font></th><th width="85%" bgcolor="#023264"><font color="#ffffff">Description</font></th></tr><tr><td align="left" valign="center"><code class="attributeName">copyXML</code></td><td align="left" valign="center">
|
| 248 | <p>Set to <code>true</code> if you want a context XML descriptor
|
| 249 | embedded inside the application (located at
|
| 250 | <code>/META-INF/context.xml</code>) to be copied to <code>xmlBase</code>
|
| 251 | when the application is deployed. On subsequent starts, the copied
|
| 252 | context XML descriptor will be used in preference to any context XML
|
| 253 | descriptor embedded inside the application even if the descriptor
|
| 254 | embedded inside the application is more recent. The flag's value
|
| 255 | defaults to <code>false</code>. Note if <strong>deployXML</strong>
|
| 256 | is <code>false</code>, this attribute will have no effect.</p>
|
| 257 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">deployXML</code></td><td align="left" valign="center">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 258 | <p>Set to <code>false</code> if you want to disable parsing the context
|
| 259 | XML descriptor embedded inside the application (located at
|
| 260 | <code>/META-INF/context.xml</code>). Security conscious environments
|
| 261 | should set this to <code>false</code> to prevent applications from
|
| 262 | interacting with the container's configuration. The administrator will
|
| 263 | then be responsible for providing an external context configuration
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 264 | file, and putting it in the location defined by the
|
| 265 | <strong>xmlBase</strong> attribute. If this flag is <code>false</code>,
|
| 266 | a descriptor is located at <code>/META-INF/context.xml</code> and no
|
| 267 | descriptor is present in <strong>xmlBase</strong> then the context will
|
| 268 | fail to start in case the descriptor contains necessary configuration
|
| 269 | for secure deployment (such as a RemoteAddrValve) which should not be
|
| 270 | ignored. The flag's value defaults to <code>true</code> unless a
|
| 271 | security manager is enabled when the default is <code>false</code>.</p>
|
| 272 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">errorReportValveClass</code></td><td align="left" valign="center">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 273 | <p>Java class name of the error reporting valve which will be used
|
| 274 | by this Host. The responsibility of this valve is to output error
|
| 275 | reports. Setting this property allows to customize the look of the
|
| 276 | error pages which will be generated by Tomcat. This class must
|
| 277 | implement the
|
| 278 | <code>org.apache.catalina.Valve</code> interface. If none is specified,
|
| 279 | the value <code>org.apache.catalina.valves.ErrorReportValve</code>
|
| 280 | will be used by default.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 281 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">unpackWARs</code></td><td align="left" valign="center">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 282 | <p>Set to <code>true</code> if you want web applications that are
|
| 283 | placed in the <code>appBase</code> directory as web application
|
| 284 | archive (WAR) files to be unpacked into a corresponding disk directory
|
| 285 | structure, <code>false</code> to run such web applications directly
|
| 286 | from a WAR file. WAR files located outside of the Host's
|
| 287 | <strong>appBase</strong> will not be expanded. See
|
| 288 | <a href="#Automatic_Application_Deployment">Automatic Application
|
| 289 | Deployment</a> for more information.</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 290 | </td></tr><tr><td align="left" valign="center"><code class="attributeName">workDir</code></td><td align="left" valign="center">
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 291 | <p>Pathname to a scratch directory to be used by applications for
|
| 292 | this Host. Each application will have its own sub directory with
|
| 293 | temporary read-write use. Configuring a Context workDir will override
|
| 294 | use of the Host workDir configuration. This directory will be made
|
| 295 | visible to servlets in the web application by a servlet context
|
| 296 | attribute (of type <code>java.io.File</code>) named
|
| 297 | <code>javax.servlet.context.tempdir</code> as described in the
|
| 298 | Servlet Specification. If not specified, a suitable directory
|
| 299 | underneath <code>$CATALINA_BASE/work</code> will be provided.</p>
|
| 300 | </td></tr></table>
|
| 301 |
|
| 302 | </blockquote></td></tr></table>
|
| 303 |
|
| 304 |
|
| 305 | </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Nested Components"><!--()--></a><a name="Nested_Components"><strong>Nested Components</strong></a></font></td></tr><tr><td><blockquote>
|
| 306 |
|
| 307 | <p>You can nest one or more <a href="context.html">Context</a> elements
|
| 308 | inside this <strong>Host</strong> element, each representing a different web
|
| 309 | application associated with this virtual host.</p>
|
| 310 |
|
| 311 | <p>You can nest at most one instance of the following utility components
|
| 312 | by nesting a corresponding element inside your <strong>Host</strong>
|
| 313 | element:</p>
|
| 314 | <ul>
|
| 315 | <li><a href="realm.html"><strong>Realm</strong></a> -
|
| 316 | Configure a realm that will allow its
|
| 317 | database of users, and their associated roles, to be shared across all
|
| 318 | <a href="context.html">Contexts</a> nested inside this Host (unless
|
| 319 | overridden by a <a href="realm.html">Realm</a> configuration
|
| 320 | at a lower level).</li>
|
| 321 | </ul>
|
| 322 |
|
| 323 | </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Special Features"><!--()--></a><a name="Special_Features"><strong>Special Features</strong></a></font></td></tr><tr><td><blockquote>
|
| 324 |
|
| 325 |
|
| 326 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Logging"><strong>Logging</strong></a></font></td></tr><tr><td><blockquote>
|
| 327 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 328 | <p>A host is associated with the
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 329 | <code>org.apache.catalina.core.ContainerBase.[engine_name].[host_name]</code>
|
| 330 | log category. Note that the brackets are part of the name,
|
| 331 | don't omit them.</p>
|
| 332 |
|
| 333 | </blockquote></td></tr></table>
|
| 334 |
|
| 335 |
|
| 336 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Access Logs"><!--()--></a><a name="Access_Logs"><strong>Access Logs</strong></a></font></td></tr><tr><td><blockquote>
|
| 337 |
|
| 338 | <p>When you run a web server, one of the output files normally generated
|
| 339 | is an <em>access log</em>, which generates one line of information for
|
| 340 | each request processed by the server, in a standard format. Catalina
|
| 341 | includes an optional <a href="valve.html">Valve</a> implementation that
|
| 342 | can create access logs in the same standard format created by web servers,
|
| 343 | or in any number of custom formats.</p>
|
| 344 |
|
| 345 | <p>You can ask Catalina to create an access log for all requests
|
| 346 | processed by an <a href="engine.html">Engine</a>,
|
| 347 | <a href="host.html">Host</a>, or <a href="context.html">Context</a>
|
| 348 | by nesting a <a href="valve.html">Valve</a> element like this:</p>
|
| 349 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 350 | <div class="codeBox"><pre><code><Host name="localhost" ...>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 351 | ...
|
| 352 | <Valve className="org.apache.catalina.valves.AccessLogValve"
|
| 353 | prefix="localhost_access_log." suffix=".txt"
|
| 354 | pattern="common"/>
|
| 355 | ...
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 356 | </Host></code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 357 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 358 | <p>See <a href="valve.html#Access_Logging">Access Logging Valves</a>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 359 | for more information on the configuration attributes that are
|
| 360 | supported.</p>
|
| 361 |
|
| 362 | </blockquote></td></tr></table>
|
| 363 |
|
| 364 |
|
| 365 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Automatic Application Deployment"><!--()--></a><a name="Automatic_Application_Deployment"><strong>Automatic Application Deployment</strong></a></font></td></tr><tr><td><blockquote>
|
| 366 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 367 | <p>If you are using the standard <strong>Host</strong> implementation with
|
| 368 | default settings then applications in the <em>appBase</em> or with context
|
| 369 | files in the <em>configBase</em> are automatically deployed when Tomcat
|
| 370 | starts (the <code>deployOnStartup</code> property defaults to
|
| 371 | <code>true</code>) and reloaded or redeployed (as appropriate) when a change
|
| 372 | is detected while Tomcat is running (the <code>autoDeploy</code> attribute
|
| 373 | also defaults to <code>true</code>).</p>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 374 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 375 | <p><code>deployOnStartup</code> and <code>autoDeploy</code> trigger
|
| 376 | execution of exactly the same code so the behaviour is very similar.
|
| 377 | However, there is one key difference. When Tomcat starts it has no knowledge
|
| 378 | of which files are the same, which have been changed and which are new. It
|
| 379 | therefore treats all files as new. While Tomcat is running, it can
|
| 380 | differentiate between unchanged, modified and new files. This leads to some
|
| 381 | differences in behaviour between files being modified while Tomcat is
|
| 382 | running and files being modified while Tomcat is stopped.</p>
|
| 383 |
|
| 384 | <p>When you use automatic deployment, related files (a web application may
|
| 385 | have a context.xml file, a WAR and a directory) that exist in the
|
| 386 | <strong>Host</strong>'s <em>appBase</em> and/or <em>configBase</em>
|
| 387 | must conform to the expected <a href="context.html#Naming">naming
|
| 388 | convention</a>. In short, this means files for the same web application must
|
| 389 | share the same <em>base name</em>.</p>
|
| 390 |
|
| 391 | <p>The automatic deployment process identifies new and/or modified web
|
| 392 | applications using the following search order:</p>
|
| 393 |
|
| 394 | <ol>
|
| 395 | <li>Web applications with a context.xml file located in the Host's
|
| 396 | <em>configBase</em>.</li>
|
| 397 | <li>Web applications with a WAR file located in the Host's
|
| 398 | <em>appBase</em> that have not already been identified during the scan for
|
| 399 | context.xml files.</li>
|
| 400 | <li>Web applications with a directory located in the Host's
|
| 401 | <em>appBase</em> that have not already been identified during the scans
|
| 402 | for context.xml and/or WAR files.</li>
|
| 403 | </ol>
|
| 404 |
|
| 405 | <p>When <code>autoDeploy</code> is <code>true</code>, the automatic
|
| 406 | deployment process will monitor the deployed web applications for changes.
|
| 407 | Depending on exactly what changes, the web application will either be
|
| 408 | re-deployed or reloaded. Re-deployment involves the creation of a new web
|
| 409 | application and, if using the standard session manager, user sessions will
|
| 410 | not be retained. Reloading uses the existing web application but re-parses
|
| 411 | the web.xml and reloads any classes. If using the standard session manager,
|
| 412 | user sessions will be persisted.</p>
|
| 413 |
|
| 414 | <p>Users may add to the files that the automatic deployment process monitors
|
| 415 | for reloading (i.e. any change to one of these files triggers a reload of
|
| 416 | the web application) by adding a <em>WatchedResources</em> element to the
|
| 417 | context.xml file. See the
|
| 418 | <a href="context.html#Nested_Components">Context</a> documentation for
|
| 419 | further details.</p>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 420 |
|
| 421 | <p>When using automatic deployment, the <code>docBase</code> defined by
|
| 422 | an XML <a href="context.html">Context</a> file should be outside of the
|
| 423 | <code>appBase</code> directory. If this is not the case, difficulties
|
| 424 | may be experienced deploying the web application or the application may
|
| 425 | be deployed twice. The <code>deployIgnore</code> attribute can be used
|
| 426 | to avoid this situation.</p>
|
| 427 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 428 | <p>Note that if you are defining contexts explicitly in server.xml, you
|
| 429 | should probably turn off automatic application deployment or specify
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 430 | <code>deployIgnore</code> carefully. Otherwise, the web applications
|
| 431 | will each be deployed twice, and that may cause problems for the
|
| 432 | applications.</p>
|
| 433 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 434 | <p>There are many possible combinations of settings, new files, changed
|
| 435 | files and deleted files. A separate page describes the
|
| 436 | <a href="automatic-deployment.html">expected behaviour of the automatic
|
| 437 | deployment process</a> in many of these scenarios.</p>
|
| 438 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 439 | </blockquote></td></tr></table>
|
| 440 |
|
| 441 |
|
| 442 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Host Name Aliases"><!--()--></a><a name="Host_Name_Aliases"><strong>Host Name Aliases</strong></a></font></td></tr><tr><td><blockquote>
|
| 443 |
|
| 444 | <p>In many server environments, Network Administrators have configured
|
| 445 | more than one network name (in the <em>Domain Name Service</em> (DNS)
|
| 446 | server), that resolve to the IP address of the same server. Normally,
|
| 447 | each such network name would be configured as a separate
|
| 448 | <strong>Host</strong> element in <code>conf/server.xml</code>, each
|
| 449 | with its own set of web applications.</p>
|
| 450 |
|
| 451 | <p>However, in some circumstances, it is desirable that two or more
|
| 452 | network names should resolve to the <strong>same</strong> virtual host,
|
| 453 | running the same set of applications. A common use case for this
|
| 454 | scenario is a corporate web site, where it is desirable that users
|
| 455 | be able to utilize either <code>www.mycompany.com</code> or
|
| 456 | <code>company.com</code> to access exactly the same content and
|
| 457 | applications.</p>
|
| 458 |
|
| 459 | <p>This is accomplished by utilizing one or more <strong>Alias</strong>
|
| 460 | elements nested inside your <strong>Host</strong> element. For
|
| 461 | example:</p>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 462 | <div class="codeBox"><pre><code><Host name="www.mycompany.com" ...>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 463 | ...
|
| 464 | <Alias>mycompany.com</Alias>
|
| 465 | ...
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 466 | </Host></code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 467 |
|
| 468 | <p>In order for this strategy to be effective, all of the network names
|
| 469 | involved must be registered in your DNS server to resolve to the
|
| 470 | same computer that is running this instance of Catalina.</p>
|
| 471 |
|
| 472 | </blockquote></td></tr></table>
|
| 473 |
|
| 474 |
|
| 475 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Lifecycle Listeners"><!--()--></a><a name="Lifecycle_Listeners"><strong>Lifecycle Listeners</strong></a></font></td></tr><tr><td><blockquote>
|
| 476 |
|
| 477 | <p>If you have implemented a Java object that needs to know when this
|
| 478 | <strong>Host</strong> is started or stopped, you can declare it by
|
| 479 | nesting a <strong>Listener</strong> element inside this element. The
|
| 480 | class name you specify must implement the
|
| 481 | <code>org.apache.catalina.LifecycleListener</code> interface, and
|
| 482 | it will be notified about the occurrence of the corresponding
|
| 483 | lifecycle events. Configuration of such a listener looks like this:</p>
|
| 484 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 485 | <div class="codeBox"><pre><code><Host name="localhost" ...>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 486 | ...
|
| 487 | <Listener className="com.mycompany.mypackage.MyListener" ... >
|
| 488 | ...
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 489 | </Host></code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 490 |
|
| 491 | <p>Note that a Listener can have any number of additional properties
|
| 492 | that may be configured from this element. Attribute names are matched
|
| 493 | to corresponding JavaBean property names using the standard property
|
| 494 | method naming patterns.</p>
|
| 495 |
|
| 496 | </blockquote></td></tr></table>
|
| 497 |
|
| 498 |
|
| 499 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Request Filters"><!--()--></a><a name="Request_Filters"><strong>Request Filters</strong></a></font></td></tr><tr><td><blockquote>
|
| 500 |
|
| 501 | <p>You can ask Catalina to check the IP address, or host name, on every
|
| 502 | incoming request directed to the surrounding
|
| 503 | <a href="engine.html">Engine</a>, <a href="host.html">Host</a>, or
|
| 504 | <a href="context.html">Context</a> element. The remote address or name
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 505 | will be checked against configured "accept" and/or "deny"
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 506 | filters, which are defined using <code>java.util.regex</code> Regular
|
| 507 | Expression syntax. Requests that come from locations that are
|
| 508 | not accepted will be rejected with an HTTP "Forbidden" error.
|
| 509 | Example filter declarations:</p>
|
| 510 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 511 | <div class="codeBox"><pre><code><Host name="localhost" ...>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 512 | ...
|
| 513 | <Valve className="org.apache.catalina.valves.RemoteHostValve"
|
| 514 | allow=".*\.mycompany\.com|www\.yourcompany\.com"/>
|
| 515 | <Valve className="org.apache.catalina.valves.RemoteAddrValve"
|
| 516 | deny="192\.168\.1\.\d+"/>
|
| 517 | ...
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 518 | </Host></code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 519 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 520 | <p>See <a href="valve.html#Remote_Address_Filter">Remote Address Filter</a>
|
| 521 | and <a href="valve.html#Remote_Host_Filter">Remote Host Filter</a> for
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 522 | more information about the configuration options that are supported.</p>
|
| 523 |
|
| 524 | </blockquote></td></tr></table>
|
| 525 |
|
| 526 |
|
| 527 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Single Sign On"><!--()--></a><a name="Single_Sign_On"><strong>Single Sign On</strong></a></font></td></tr><tr><td><blockquote>
|
| 528 |
|
| 529 | <p>In many environments, but particularly in portal environments, it
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 530 | is desirable to have a user challenged to authenticate themselves only
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 531 | once over a set of web applications deployed on a particular virtual
|
| 532 | host. This can be accomplished by nesting an element like this inside
|
| 533 | the Host element for this virtual host:</p>
|
| 534 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 535 | <div class="codeBox"><pre><code><Host name="localhost" ...>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 536 | ...
|
| 537 | <Valve className="org.apache.catalina.authenticator.SingleSignOn"/>
|
| 538 | ...
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 539 | </Host></code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 540 |
|
| 541 | <p>The Single Sign On facility operates according to the following rules:
|
| 542 | </p>
|
| 543 | <ul>
|
| 544 | <li>All web applications configured for this virtual host must share the
|
| 545 | same <a href="realm.html">Realm</a>. In practice, that means you can
|
| 546 | nest the Realm element inside this Host element (or the surrounding
|
| 547 | <a href="engine.html">Engine</a> element), but not inside a
|
| 548 | <a href="context.html">Context</a> element for one of the involved
|
| 549 | web applications.</li>
|
| 550 | <li>As long as the user accesses only unprotected resources in any of the
|
| 551 | web applications on this virtual host, they will not be challenged
|
| 552 | to authenticate themselves.</li>
|
| 553 | <li>As soon as the user accesses a protected resource in
|
| 554 | <strong>any</strong> web application associated with this virtual
|
| 555 | host, the user will be challenged to authenticate himself or herself,
|
| 556 | using the login method defined for the web application currently
|
| 557 | being accessed.</li>
|
| 558 | <li>Once authenticated, the roles associated with this user will be
|
| 559 | utilized for access control decisions across <strong>all</strong>
|
| 560 | of the associated web applications, without challenging the user
|
| 561 | to authenticate themselves to each application individually.</li>
|
| 562 | <li>As soon as the user logs out of one web application (for example,
|
| 563 | by invalidating the corresponding session if form
|
| 564 | based login is used), the user's sessions in <strong>all</strong>
|
| 565 | web applications will be invalidated. Any subsequent attempt to
|
| 566 | access a protected resource in any application will require the
|
| 567 | user to authenticate himself or herself again.</li>
|
| 568 | <li>The Single Sign On feature utilizes HTTP cookies to transmit a token
|
| 569 | that associates each request with the saved user identity, so it can
|
| 570 | only be utilized in client environments that support cookies.</li>
|
| 571 | </ul>
|
| 572 |
|
| 573 | </blockquote></td></tr></table>
|
| 574 |
|
| 575 |
|
| 576 | <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="User Web Applications"><!--()--></a><a name="User_Web_Applications"><strong>User Web Applications</strong></a></font></td></tr><tr><td><blockquote>
|
| 577 |
|
| 578 | <p>Many web servers can automatically map a request URI starting with
|
| 579 | a tilde character ("~") and a username to a directory (commonly named
|
| 580 | <code>public_html</code>) in that user's home directory on the server.
|
| 581 | You can accomplish the same thing in Catalina by using a special
|
| 582 | <strong>Listener</strong> element like this (on a Unix system that
|
| 583 | uses the <code>/etc/passwd</code> file to identify valid users):</p>
|
| 584 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 585 | <div class="codeBox"><pre><code><Host name="localhost" ...>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 586 | ...
|
| 587 | <Listener className="org.apache.catalina.startup.UserConfig"
|
| 588 | directoryName="public_html"
|
| 589 | userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
|
| 590 | ...
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 591 | </Host></code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 592 |
|
| 593 | <p>On a server where <code>/etc/passwd</code> is not in use, you can
|
| 594 | request Catalina to consider all directories found in a specified base
|
| 595 | directory (such as <code>c:\Homes</code> in this example) to be
|
| 596 | considered "user home" directories for the purposes of this directive:</p>
|
| 597 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 598 | <div class="codeBox"><pre><code><Host name="localhost" ...>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 599 | ...
|
| 600 | <Listener className="org.apache.catalina.startup.UserConfig"
|
| 601 | directoryName="public_html"
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 602 | homeBase="c:\Homes"
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 603 | userClass="org.apache.catalina.startup.HomesUserDatabase"/>
|
| 604 | ...
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 605 | </Host></code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 606 |
|
| 607 | <p>If a user home directory has been set up for a user named
|
| 608 | <code>craigmcc</code>, then its contents will be visible from a
|
| 609 | client browser by making a request to a URL like:</p>
|
| 610 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 611 | <div class="codeBox"><pre><code>http://www.mycompany.com:8080/~craigmcc</code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 612 |
|
| 613 | <p>Successful use of this feature requires recognition of the following
|
| 614 | considerations:</p>
|
| 615 | <ul>
|
| 616 | <li>Each user web application will be deployed with characteristics
|
| 617 | established by the global and host level default context settings.</li>
|
| 618 | <li>It is legal to include more than one instance of this Listener
|
| 619 | element. This would only be useful, however, in circumstances
|
| 620 | where you wanted to configure more than one "homeBase" directory.</li>
|
| 621 | <li>The operating system username under which Catalina is executed
|
| 622 | MUST have read access to each user's web application directory,
|
| 623 | and all of its contents.</li>
|
| 624 | </ul>
|
| 625 |
|
| 626 | </blockquote></td></tr></table>
|
| 627 |
|
| 628 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 629 | </blockquote></td></tr></table></td></tr><tr class="noPrint"><td width="20%" valign="top" nowrap class="noPrint"></td><td width="80%" valign="top" align="left"><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="comments_section" id="comments_section"><strong>Comments</strong></a></font></td></tr><tr><td><blockquote><p class="notice"><strong>Notice: </strong>This comments section collects your suggestions
|
| 630 | on improving documentation for Apache Tomcat.<br><br>
|
| 631 | If you have trouble and need help, read
|
| 632 | <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
|
| 633 | and ask your question on the tomcat-users
|
| 634 | <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
|
| 635 | Do not ask such questions here. This is not a Q&A section.<br><br>
|
| 636 | The Apache Comments System is explained <a href="../comments.html">here</a>.
|
| 637 | Comments may be removed by our moderators if they are either
|
| 638 | implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
|
| 639 | var comments_shortname = 'tomcat';
|
| 640 | var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/config/host.html';
|
| 641 | (function(w, d) {
|
| 642 | if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
|
| 643 | d.write('<div id="comments_thread"><\/div>');
|
| 644 | var s = d.createElement('script');
|
| 645 | s.type = 'text/javascript';
|
| 646 | s.async = true;
|
| 647 | s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
|
| 648 | (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
|
| 649 | }
|
| 650 | else {
|
| 651 | d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
|
| 652 | }
|
| 653 | })(window, document);
|
| 654 | //--><!]]></script></blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
|
| 655 | Copyright © 1999-2017, Apache Software Foundation
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 656 | </em></font></div></td></tr></table></body></html> |