| 刘洪青 | 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 Manager Component</title><meta name="author" content="Craig R. McClanahan"><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 Manager Component</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="#Persistence_Across_Restarts">Persistence Across Restarts</a></li><li><a href="#Disable_Session_Persistence">Disable Session Persistence</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>Manager</strong> element represents the <em>session
 | 
 | 86 |   manager</em> that will be used to create and maintain HTTP sessions
 | 
 | 87 |   as requested by the associated web application.</p>
 | 
 | 88 | 
 | 
 | 89 |   <p>A Manager element MAY be nested inside a
 | 
 | 90 |   <a href="context.html">Context</a> component.  If it is not included,
 | 
 | 91 |   a default Manager configuration will be created automatically, which
 | 
 | 92 |   is sufficient for most requirements, — see
 | 
 | 93 |   <em>Standard Manager Implementation</em> below for the details
 | 
 | 94 |   of this configuration.</p>
 | 
 | 95 | 
 | 
 | 96 | </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>
 | 
 | 97 | 
 | 
 | 98 |   <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>
 | 
 | 99 | 
 | 
 | 100 |     <p>All implementations of <strong>Manager</strong>
 | 
 | 101 |     support the following attributes:</p>
 | 
 | 102 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 103 |     <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">className</code></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 104 |         <p>Java class name of the implementation to use.  This class must
 | 
 | 105 |         implement the <code>org.apache.catalina.Manager</code> interface.
 | 
 | 106 |         If not specified, the standard value (defined below) will be used.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 107 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">distributable</code></td><td align="left" valign="center">
 | 
 | 108 |         <p><strong>Deprecated</strong>: This should be configured via the
 | 
 | 109 |         Context.</p>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 110 |         <p>Set to <code>true</code> to ask the session manager to enforce
 | 
 | 111 |         the restrictions described in the Servlet Specification on
 | 
 | 112 |         distributable applications (primarily, this would mean that all
 | 
 | 113 |         session attributes must implement <code>java.io.Serializable</code>).
 | 
 | 114 |         Set to <code>false</code> (the default) to not enforce these
 | 
 | 115 |         restrictions.</p>
 | 
 | 116 | 
 | 
 | 117 |         <p><strong>NOTE</strong> - The value for this property is inherited
 | 
 | 118 |         automatically based on the presence or absence of the
 | 
 | 119 |         <code><distributable></code> element in the web application
 | 
 | 120 |         deployment descriptor (<code>/WEB-INF/web.xml</code>).</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 121 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">maxActiveSessions</code></td><td align="left" valign="center">
 | 
 | 122 |         <p>The maximum number of active sessions that will be created by
 | 
 | 123 |         this Manager, or <code>-1</code> (the default) for no limit.</p>
 | 
 | 124 | 
 | 
 | 125 |         <p>When the limit is reached, any attempt to create a new session
 | 
 | 126 |         (e.g. with <code>HttpServletRequest.getSession()</code> call)
 | 
 | 127 |         will fail with an <code>IllegalStateException</code>.</p>
 | 
 | 128 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">maxInactiveInterval</code></td><td align="left" valign="center">
 | 
 | 129 |         <p><strong>Deprecated</strong>: This should be configured via the
 | 
 | 130 |         Context.</p>
 | 
 | 131 |         <p>The initial maximum time interval, in seconds,
 | 
 | 132 |         between client requests before a session is invalidated. A negative value
 | 
 | 133 |         will result in sessions never timing out. If the attribute is not provided,
 | 
 | 134 |         a default of 1800 seconds (30 minutes) is used.</p>
 | 
 | 135 | 
 | 
 | 136 |         <p>This attribute provides the initial value whenever a
 | 
 | 137 |         new session is created, but the interval may be dynamically
 | 
 | 138 |         varied by a servlet via the
 | 
 | 139 |         <code>setMaxInactiveInterval</code> method of the <code>HttpSession</code> object.</p>
 | 
 | 140 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">sessionIdLength</code></td><td align="left" valign="center">
 | 
 | 141 |        <p>The length of session ids created by this Manager, measured in bytes,
 | 
 | 142 |         excluding subsequent conversion to a hexadecimal string and
 | 
 | 143 |         excluding any JVM route information used for load balancing.
 | 
 | 144 |         The default is 16. You should set the length on a nested
 | 
 | 145 |         <strong>SessionIdGenerator</strong> element instead.</p>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 146 |       </td></tr></table>
 | 
 | 147 | 
 | 
 | 148 |   </blockquote></td></tr></table>
 | 
 | 149 | 
 | 
 | 150 | 
 | 
 | 151 |   <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>
 | 
 | 152 | 
 | 
 | 153 |     <p>Tomcat provides two standard implementations of <strong>Manager</strong>
 | 
 | 154 |     for use — the default one stores active sessions, while the optional one
 | 
 | 155 |     stores active sessions that have been swapped out (in addition to saving
 | 
 | 156 |     sessions across a restart of Tomcat) in a storage location that is selected
 | 
 | 157 |     via the use of an appropriate <strong>Store</strong> nested element.</p>
 | 
 | 158 | 
 | 
 | 159 |     <h3>Standard Manager Implementation</h3>
 | 
 | 160 | 
 | 
 | 161 |     <p>The standard implementation of <strong>Manager</strong> is
 | 
 | 162 |     <strong>org.apache.catalina.session.StandardManager</strong>.
 | 
 | 163 |     It supports the following additional attributes (in addition to the
 | 
 | 164 |     common attributes listed above):</p>
 | 
 | 165 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 166 |     <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">pathname</code></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 167 |         <p>Absolute or relative (to the work directory for this Context)
 | 
 | 168 |         pathname of the file in which session state will be preserved
 | 
 | 169 |         across application restarts, if possible.  The default is
 | 
 | 170 |         "SESSIONS.ser".<br>See
 | 
 | 171 |         <a href="#Persistence_Across_Restarts">Persistence Across Restarts</a>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 172 |         for more information. This persistence may be
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 173 |         disabled by setting this attribute to an empty string.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 174 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">processExpiresFrequency</code></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 175 |         <p>Frequency of the session expiration, and related manager operations.
 | 
 | 176 |         Manager operations will be done once for the specified amount of
 | 
 | 177 |         backgroundProcess calls (i.e., the lower the amount, the more often the
 | 
 | 178 |         checks will occur). The minimum value is 1, and the default value is 6.
 | 
 | 179 |         </p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 180 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">secureRandomClass</code></td><td align="left" valign="center">
 | 
 | 181 |         <p>Name of the Java class that extends
 | 
 | 182 |         <code>java.security.SecureRandom</code> to use to generate session IDs.
 | 
 | 183 |         If not specified, the default value is
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 184 |         <code>java.security.SecureRandom</code>.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 185 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">secureRandomProvider</code></td><td align="left" valign="center">
 | 
 | 186 |         <p>Name of the provider to use to create the
 | 
 | 187 |         <code>java.security.SecureRandom</code> instances that generate session
 | 
 | 188 |         IDs. If an invalid algorithm and/or provider is specified, the Manager
 | 
 | 189 |         will use the platform default provider and the default algorithm. If not
 | 
 | 190 |         specified, the platform default provider will be used.</p>
 | 
 | 191 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">secureRandomAlgorithm</code></td><td align="left" valign="center">
 | 
 | 192 |         <p>Name of the algorithm to use to create the
 | 
 | 193 |         <code>java.security.SecureRandom</code> instances that generate session
 | 
 | 194 |         IDs. If an invalid algorithm and/or provider is specified, the Manager
 | 
 | 195 |         will use the platform default provider and the default algorithm. If not
 | 
 | 196 |         specified, the default algorithm of SHA1PRNG will be used. If the
 | 
 | 197 |         default algorithm is not supported, the platform default will be used.
 | 
 | 198 |         To specify that the platform default should be used, do not set the
 | 
 | 199 |         secureRandomProvider attribute and set this attribute to the empty
 | 
 | 200 |         string.</p>
 | 
 | 201 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">sessionAttributeNameFilter</code></td><td align="left" valign="center">
 | 
 | 202 |         <p>A regular expression used to filter which session attributes will be
 | 
 | 203 |         distributed. An attribute will only be distributed if its name matches
 | 
 | 204 |         this pattern. If the pattern is zero length or <code>null</code>, all
 | 
 | 205 |         attributes are eligible for distribution. The pattern is anchored so the
 | 
 | 206 |         session attribute name must fully match the pattern. As an example, the
 | 
 | 207 |         value <code>(userName|sessionHistory)</code> will only distribute the
 | 
 | 208 |         two session attributes named <code>userName</code> and
 | 
 | 209 |         <code>sessionHistory</code>. If not specified, the default value of
 | 
 | 210 |         <code>null</code> will be used.</p>
 | 
 | 211 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">sessionAttributeValueClassNameFilter</code></td><td align="left" valign="center">
 | 
 | 212 |         <p>A regular expression used to filter which session attributes will be
 | 
 | 213 |         distributed. An attribute will only be distributed if the implementation
 | 
 | 214 |         class name of the value matches this pattern. If the pattern is zero
 | 
 | 215 |         length or <code>null</code>, all attributes are eligible for
 | 
 | 216 |         distribution. The pattern is anchored so the fully qualified class name
 | 
 | 217 |         must fully match the pattern. If not specified, the default value of
 | 
 | 218 |         <code>null</code> will be used unless a <code>SecurityManager</code> is
 | 
 | 219 |         enabled in which case the default will be
 | 
 | 220 |         <code>java\\.lang\\.(?:Boolean|Integer|Long|Number|String)</code>.</p>
 | 
 | 221 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">warnOnSessionAttributeFilterFailure</code></td><td align="left" valign="center">
 | 
 | 222 |         <p>If <strong>sessionAttributeNameFilter</strong> or
 | 
 | 223 |         <strong>sessionAttributeValueClassNameFilter</strong> blocks an
 | 
 | 224 |         attribute, should this be logged at <code>WARN</code> level? If
 | 
 | 225 |         <code>WARN</code> level logging is disabled then it will be logged at
 | 
 | 226 |         <code>DEBUG</code>. The default value of this attribute is
 | 
 | 227 |         <code>false</code> unless a <code>SecurityManager</code> is enabled in
 | 
 | 228 |         which case the default will be <code>true</code>.</p>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 229 |       </td></tr></table>
 | 
 | 230 | 
 | 
 | 231 |     <h3>Persistent Manager Implementation</h3>
 | 
 | 232 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 233 |     <p><strong>NOTE:</strong> You must set either the
 | 
 | 234 |     <code>org.apache.catalina.session.StandardSession.ACTIVITY_CHECK</code> or
 | 
 | 235 |     <code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE</code>
 | 
 | 236 |     <a href="systemprops.html">system properties</a> to <code>true</code> for
 | 
 | 237 |     the persistent manager to work correctly.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 238 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 239 |     <p>The persistent implementation of <strong>Manager</strong> is
 | 
 | 240 |     <strong>org.apache.catalina.session.PersistentManager</strong>.  In
 | 
 | 241 |     addition to the usual operations of creating and deleting sessions, a
 | 
 | 242 |     <code>PersistentManager</code> has the capability to swap active (but
 | 
 | 243 |     idle) sessions out to a persistent storage mechanism, as well as to save
 | 
 | 244 |     all sessions across a normal restart of Tomcat.  The actual persistent
 | 
 | 245 |     storage mechanism used is selected by your choice of a
 | 
 | 246 |     <strong>Store</strong> element nested inside the <strong>Manager</strong>
 | 
 | 247 |     element - this is required for use of <code>PersistentManager</code>.</p>
 | 
 | 248 | 
 | 
 | 249 |     <p>This implementation of Manager supports the following attributes in
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 250 |     addition to the <a href="#Common_Attributes">Common Attributes</a>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 251 |     described earlier.</p>
 | 
 | 252 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 253 |     <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">className</code></strong></td><td align="left" valign="center">
 | 
 | 254 |         <p>It has the same meaning as described in the
 | 
 | 255 |         <a href="#Common_Attributes">Common Attributes</a> above.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 256 |         You <strong>must</strong> specify
 | 
 | 257 |         <code>org.apache.catalina.session.PersistentManager</code> to use
 | 
 | 258 |         this manager implementation.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 259 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">maxIdleBackup</code></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 260 |         <p>The time interval (in seconds) since the last access to a session
 | 
 | 261 |         before it is eligible for being persisted to the session store, or
 | 
 | 262 |         <code>-1</code> to disable this feature.  By default, this feature is
 | 
 | 263 |         disabled.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 264 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">maxIdleSwap</code></td><td align="left" valign="center">
 | 
 | 265 |         <p>The maximum time a session may be idle before it is eligible to be
 | 
 | 266 |         swapped to disk due to inactivity. Setting this to <code>-1</code> means
 | 
 | 267 |         sessions should not be swapped out just because of inactivity. If this
 | 
 | 268 |         feature is enabled, the time interval specified here should be equal to
 | 
 | 269 |         or longer than the value specified for <code>maxIdleBackup</code>. By
 | 
 | 270 |         default, this feature is disabled.</p>
 | 
 | 271 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">minIdleSwap</code></td><td align="left" valign="center">
 | 
 | 272 |         <p>The minimum time in seconds a session must be idle before it is
 | 
 | 273 |         eligible to be swapped to disk to keep the active session count below
 | 
 | 274 |         maxActiveSessions. Setting to <code>-1</code> means sessions will not be
 | 
 | 275 |         swapped out to keep the active session count down. If specified, this
 | 
 | 276 |         value should be less than that specified by <code>maxIdleSwap</code>.
 | 
 | 277 |         By default, this value is set to <code>-1</code>.</p>
 | 
 | 278 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">processExpiresFrequency</code></td><td align="left" valign="center">
 | 
 | 279 |         <p>It is the same as described above for the
 | 
 | 280 |         <code>org.apache.catalina.session.StandardManager</code> class.
 | 
 | 281 |         </p>
 | 
 | 282 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">saveOnRestart</code></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 283 |         <p>Should all sessions be persisted and reloaded when Tomcat is shut
 | 
 | 284 |         down and restarted (or when this application is reloaded)?  By default,
 | 
 | 285 |         this attribute is set to <code>true</code>.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 286 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">secureRandomClass</code></td><td align="left" valign="center">
 | 
 | 287 |         <p>It is the same as described above for the
 | 
 | 288 |         <code>org.apache.catalina.session.StandardManager</code> class.
 | 
 | 289 |         </p>
 | 
 | 290 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">secureRandomProvider</code></td><td align="left" valign="center">
 | 
 | 291 |         <p>It is the same as described above for the
 | 
 | 292 |         <code>org.apache.catalina.session.StandardManager</code> class.
 | 
 | 293 |         </p>
 | 
 | 294 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">secureRandomAlgorithm</code></td><td align="left" valign="center">
 | 
 | 295 |         <p>It is the same as described above for the
 | 
 | 296 |         <code>org.apache.catalina.session.StandardManager</code> class.
 | 
 | 297 |         </p>
 | 
 | 298 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">sessionAttributeNameFilter</code></td><td align="left" valign="center">
 | 
 | 299 |         <p>A regular expression used to filter which session attributes will be
 | 
 | 300 |         distributed. An attribute will only be distributed if its name matches
 | 
 | 301 |         this pattern. If the pattern is zero length or <code>null</code>, all
 | 
 | 302 |         attributes are eligible for distribution. The pattern is anchored so the
 | 
 | 303 |         session attribute name must fully match the pattern. As an example, the
 | 
 | 304 |         value <code>(userName|sessionHistory)</code> will only distribute the
 | 
 | 305 |         two session attributes named <code>userName</code> and
 | 
 | 306 |         <code>sessionHistory</code>. If not specified, the default value of
 | 
 | 307 |         <code>null</code> will be used.</p>
 | 
 | 308 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">sessionAttributeValueClassNameFilter</code></td><td align="left" valign="center">
 | 
 | 309 |         <p>A regular expression used to filter which session attributes will be
 | 
 | 310 |         distributed. An attribute will only be distributed if the implementation
 | 
 | 311 |         class name of the value matches this pattern. If the pattern is zero
 | 
 | 312 |         length or <code>null</code>, all attributes are eligible for
 | 
 | 313 |         distribution. The pattern is anchored so the fully qualified class name
 | 
 | 314 |         must fully match the pattern. If not specified, the default value of
 | 
 | 315 |         <code>null</code> will be used unless a <code>SecurityManager</code> is
 | 
 | 316 |         enabled in which case the default will be
 | 
 | 317 |         <code>java\\.lang\\.(?:Boolean|Integer|Long|Number|String)</code>.</p>
 | 
 | 318 |       </td></tr><tr><td align="left" valign="center"><code class="attributeName">warnOnSessionAttributeFilterFailure</code></td><td align="left" valign="center">
 | 
 | 319 |         <p>If <strong>sessionAttributeNameFilter</strong> or
 | 
 | 320 |         <strong>sessionAttributeValueClassNameFilter</strong> blocks an
 | 
 | 321 |         attribute, should this be logged at <code>WARN</code> level? If
 | 
 | 322 |         <code>WARN</code> level logging is disabled then it will be logged at
 | 
 | 323 |         <code>DEBUG</code>. The default value of this attribute is
 | 
 | 324 |         <code>false</code> unless a <code>SecurityManager</code> is enabled in
 | 
 | 325 |         which case the default will be <code>true</code>.</p>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 326 |       </td></tr></table>
 | 
 | 327 | 
 | 
 | 328 |     <p>In order to successfully use a PersistentManager, you must nest inside
 | 
 | 329 |     it a <strong><Store></strong> element, as described below.</p>
 | 
 | 330 | 
 | 
 | 331 |   </blockquote></td></tr></table>
 | 
 | 332 | 
 | 
 | 333 | 
 | 
 | 334 | </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>
 | 
 | 335 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 336 |   <h3>All Manager Implementations</h3>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 337 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 338 |   <p>All Manager implementations bundled with Tomcat or extending
 | 
 | 339 |   <code>ManagerBase</code> allow nesting of a
 | 
 | 340 |   <strong><SessionIdGenerator></strong> element. It defines
 | 
 | 341 |   the behavior of session id generation.  All implementations
 | 
 | 342 |   of the <a href="sessionidgenerator.html">SessionIdGenerator</a> allow the
 | 
 | 343 |   following attributes:
 | 
 | 344 |   </p>
 | 
 | 345 | 
 | 
 | 346 |   <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">sessionIdLength</code></td><td align="left" valign="center">
 | 
 | 347 |       <p>The length of the session ID may be changed with the
 | 
 | 348 |       <strong>sessionIdLength</strong> attribute.
 | 
 | 349 |       </p>
 | 
 | 350 |     </td></tr></table>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 351 | 
 | 
 | 352 |   <h3>Persistent Manager Implementation</h3>
 | 
 | 353 | 
 | 
 | 354 |   <p>If you are using the <em>Persistent Manager Implementation</em>
 | 
 | 355 |   as described above, you <strong>MUST</strong> nest a
 | 
 | 356 |   <strong><Store></strong> element inside, which defines the
 | 
 | 357 |   characteristics of the persistent data storage.  Two implementations
 | 
 | 358 |   of the <code><Store></code> element are currently available,
 | 
 | 359 |   with different characteristics, as described below.</p>
 | 
 | 360 | 
 | 
 | 361 |   <h5>File Based Store</h5>
 | 
 | 362 | 
 | 
 | 363 |   <p>The <em>File Based Store</em> implementation saves swapped out
 | 
 | 364 |   sessions in individual files (named based on the session identifier)
 | 
 | 365 |   in a configurable directory.  Therefore, you are likely to encounter
 | 
 | 366 |   scalability problems as the number of active sessions increases, and
 | 
 | 367 |   this should primarily be considered a means to easily experiment.</p>
 | 
 | 368 | 
 | 
 | 369 |   <p>To configure this, add a <code><Store></code> nested inside
 | 
 | 370 |   your <code><Manager></code> element with the following attributes:
 | 
 | 371 |   </p>
 | 
 | 372 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 373 |   <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">checkInterval</code></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 374 |       <p>The interval (in seconds) between checks for expired sessions
 | 
 | 375 |       among those sessions that are currently swapped out.  By default,
 | 
 | 376 |       this interval is set to 60 seconds (one minute).</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 377 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">className</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 378 |       <p>Java class name of the implementation to use.  This class must
 | 
 | 379 |       implement the <code>org.apache.catalina.Store</code> interface.  You
 | 
 | 380 |       <strong>must</strong> specify
 | 
 | 381 |       <code>org.apache.catalina.session.FileStore</code>
 | 
 | 382 |       to use this implementation.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 383 |     </td></tr><tr><td align="left" valign="center"><code class="attributeName">directory</code></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 384 |       <p>Absolute or relative (to the temporary work directory for this web
 | 
 | 385 |       application) pathname of the directory into which individual session
 | 
 | 386 |       files are written.  If not specified, the temporary work directory
 | 
 | 387 |       assigned by the container is utilized.</p>
 | 
 | 388 |     </td></tr></table>
 | 
 | 389 | 
 | 
 | 390 | 
 | 
 | 391 |   <h5>JDBC Based Store</h5>
 | 
 | 392 | 
 | 
 | 393 |   <p>The <em>JDBC Based Store</em> implementation saves swapped out
 | 
 | 394 |   sessions in individual rows of a preconfigured table in a database
 | 
 | 395 |   that is accessed via a JDBC driver.  With large numbers of swapped out
 | 
 | 396 |   sessions, this implementation will exhibit improved performance over
 | 
 | 397 |   the File Based Store described above.</p>
 | 
 | 398 | 
 | 
 | 399 |   <p>To configure this, add a <code><Store></code> nested inside
 | 
 | 400 |   your <code><Manager></code> element with the following attributes:
 | 
 | 401 |   </p>
 | 
 | 402 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 403 |   <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">checkInterval</code></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 404 |       <p>The interval (in seconds) between checks for expired sessions
 | 
 | 405 |       among those sessions that are currently swapped out.  By default,
 | 
 | 406 |       this interval is set to 60 seconds (one minute).</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 407 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">className</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 408 |       <p>Java class name of the implementation to use.  This class must
 | 
 | 409 |       implement the <code>org.apache.catalina.Store</code> interface.  You
 | 
 | 410 |       <strong>must</strong> specify
 | 
 | 411 |       <code>org.apache.catalina.session.JDBCStore</code>
 | 
 | 412 |       to use this implementation.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 413 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">connectionURL</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 414 |       <p>The connection URL that will be handed to the configured JDBC
 | 
 | 415 |       driver to establish a connection to the database containing our
 | 
 | 416 |       session table.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 417 |     </td></tr><tr><td align="left" valign="center"><code class="attributeName">dataSourceName</code></td><td align="left" valign="center">
 | 
 | 418 |       <p>Name of the JNDI resource for a JDBC DataSource-factory. If this option
 | 
 | 419 |       is given and a valid JDBC resource can be found, it will be used and any
 | 
 | 420 |       direct configuration of a JDBC connection via <code>connectionURL</code>
 | 
 | 421 |       and <code>driverName</code> will be ignored. Since this code uses prepared
 | 
 | 422 |       statements, you might want to configure pooled prepared statements as
 | 
 | 423 |       shown in <a href="../jndi-resources-howto.html">the JNDI resources
 | 
 | 424 |       HOW-TO</a>.</p>
 | 
 | 425 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">driverName</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 426 |       <p>Java class name of the JDBC driver to be used.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 427 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">sessionAppCol</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 428 |       <p>Name of the database column, contained in the specified session
 | 
 | 429 |       table, that contains the Engine, Host, and Web Application Context
 | 
 | 430 |       name in the format <code>/Engine/Host/Context</code>.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 431 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">sessionDataCol</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 432 |       <p>Name of the database column, contained in the specified
 | 
 | 433 |       session table, that contains the serialized form of all session
 | 
 | 434 |       attributes for a swapped out session.  The column type must accept
 | 
 | 435 |       a binary object (typically called a BLOB).</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 436 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">sessionIdCol</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 437 |       <p>Name of the database column, contained in the specified
 | 
 | 438 |       session table, that contains the session identifier of the
 | 
 | 439 |       swapped out session.  The column type must accept character
 | 
 | 440 |       string data of at least as many characters as are contained
 | 
 | 441 |       in session identifiers created by Tomcat (typically 32).</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 442 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">sessionLastAccessedCol</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 443 |       <p>Name of the database column, contained in the specified
 | 
 | 444 |       session table, that contains the <code>lastAccessedTime</code>
 | 
 | 445 |       property of this session.  The column type must accept a
 | 
 | 446 |       Java <code>long</code> (64 bits).</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 447 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">sessionMaxInactiveCol</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 448 |       <p>Name of the database column, contained in the specified
 | 
 | 449 |       session table, that contains the <code>maxInactiveInterval</code>
 | 
 | 450 |       property of this session.  The column type must accept a
 | 
 | 451 |       Java <code>integer</code> (32 bits).</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 452 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">sessionTable</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 453 |       <p>Name of the database table to be used for storing swapped out
 | 
 | 454 |       sessions.  This table must contain (at least) the database columns
 | 
 | 455 |       that are configured by the other attributes of this element.</p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 456 |     </td></tr><tr><td align="left" valign="center"><strong><code class="attributeName">sessionValidCol</code></strong></td><td align="left" valign="center">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 457 |       <p>Name of the database column, contained in the specified
 | 
 | 458 |       session table, that contains a flag indicating whether this
 | 
 | 459 |       swapped out session is still valid or not.  The column type
 | 
 | 460 |       must accept a single character.</p>
 | 
 | 461 |     </td></tr></table>
 | 
 | 462 | 
 | 
 | 463 |   <p>Before attempting to use the JDBC Based Store for the first time,
 | 
 | 464 |   you must create the table that will be used to store swapped out sessions.
 | 
 | 465 |   Detailed SQL commands vary depending on the database you are using, but
 | 
 | 466 |   a script like this will generally be required:</p>
 | 
 | 467 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 468 | <div class="codeBox"><pre><code>create table tomcat_sessions (
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 469 |   session_id     varchar(100) not null primary key,
 | 
 | 470 |   valid_session  char(1) not null,
 | 
 | 471 |   max_inactive   int not null,
 | 
 | 472 |   last_access    bigint not null,
 | 
 | 473 |   app_name       varchar(255),
 | 
 | 474 |   session_data   mediumblob,
 | 
 | 475 |   KEY kapp_name(app_name)
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 476 | );</code></pre></div>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 477 | 
 | 
 | 478 |   <p>In order for the JDBC Based Store to successfully connect to your
 | 
 | 479 |   database, the JDBC driver you configure must be visible to Tomcat's
 | 
 | 480 |   internal class loader.  Generally, that means you must place the JAR
 | 
 | 481 |   file containing this driver into the <code>$CATALINA_HOME/lib</code>
 | 
 | 482 |   directory.</p>
 | 
 | 483 | 
 | 
 | 484 | </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>
 | 
 | 485 | 
 | 
 | 486 | 
 | 
 | 487 |   <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Persistence Across Restarts"><!--()--></a><a name="Persistence_Across_Restarts"><strong>Persistence Across Restarts</strong></a></font></td></tr><tr><td><blockquote>
 | 
 | 488 | 
 | 
 | 489 |     <p>Whenever Apache Tomcat is shut down normally and restarted, or when an
 | 
 | 490 |     application reload is triggered, the standard Manager implementation
 | 
 | 491 |     will attempt to serialize all currently active sessions to a disk
 | 
 | 492 |     file located via the <code>pathname</code> attribute.  All such saved
 | 
 | 493 |     sessions will then be deserialized and activated (assuming they have
 | 
 | 494 |     not expired in the mean time) when the application reload is completed.</p>
 | 
 | 495 | 
 | 
 | 496 |     <p>In order to successfully restore the state of session attributes,
 | 
 | 497 |     all such attributes MUST implement the <code>java.io.Serializable</code>
 | 
 | 498 |     interface.  You MAY cause the Manager to enforce this restriction by
 | 
 | 499 |     including the <code><distributable></code> element in your web
 | 
 | 500 |     application deployment descriptor (<code>/WEB-INF/web.xml</code>).</p>
 | 
 | 501 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 502 |     <p>The persistence across restarts provided by the
 | 
 | 503 |     <strong>StandardManager</strong> is a simpler implementation than that
 | 
 | 504 |     provided by the <strong>PersistentManager</strong>. If robust, production
 | 
 | 505 |     quality persistence across restarts is required then the
 | 
 | 506 |     <strong>PersistentManager</strong> should be used with an appropriate
 | 
 | 507 |     configuration.</p>
 | 
 | 508 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 509 |   </blockquote></td></tr></table>
 | 
 | 510 | 
 | 
 | 511 |   <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Disable Session Persistence"><!--()--></a><a name="Disable_Session_Persistence"><strong>Disable Session Persistence</strong></a></font></td></tr><tr><td><blockquote>
 | 
 | 512 | 
 | 
 | 513 |     <p>As documented above, every web application by default has
 | 
 | 514 |     standard manager implementation configured, and it performs session
 | 
 | 515 |     persistence across restarts. To disable this persistence feature, create
 | 
 | 516 |     a <a href="context.html">Context</a> configuration file for your web
 | 
 | 517 |     application and add the following element there:</p>
 | 
 | 518 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 519 |     <div class="codeBox"><pre><code><Manager pathname="" /></code></pre></div>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 520 |   </blockquote></td></tr></table>
 | 
 | 521 | 
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 522 | </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
 | 
 | 523 |               on improving documentation for Apache Tomcat.<br><br>
 | 
 | 524 |               If you have trouble and need help, read
 | 
 | 525 |               <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
 | 
 | 526 |               and ask your question on the tomcat-users
 | 
 | 527 |               <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
 | 
 | 528 |               Do not ask such questions here. This is not a Q&A section.<br><br>
 | 
 | 529 |               The Apache Comments System is explained <a href="../comments.html">here</a>.
 | 
 | 530 |               Comments may be removed by our moderators if they are either
 | 
 | 531 |               implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
 | 
 | 532 |               var comments_shortname = 'tomcat';
 | 
 | 533 |               var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/config/manager.html';
 | 
 | 534 |               (function(w, d) {
 | 
 | 535 |                   if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
 | 
 | 536 |                       d.write('<div id="comments_thread"><\/div>');
 | 
 | 537 |                       var s = d.createElement('script');
 | 
 | 538 |                       s.type = 'text/javascript';
 | 
 | 539 |                       s.async = true;
 | 
 | 540 |                       s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
 | 
 | 541 |                       (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
 | 
 | 542 |                   }
 | 
 | 543 |                   else {
 | 
 | 544 |                       d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
 | 
 | 545 |                   }
 | 
 | 546 |               })(window, document);
 | 
 | 547 |               //--><!]]></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>
 | 
 | 548 |         Copyright © 1999-2017, Apache Software Foundation
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 549 |         </em></font></div></td></tr></table></body></html> |