Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame^] | 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat Configuration Reference (6.0.39) - 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></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="
|
| 5 | The Apache Tomcat Servlet/JSP Container
|
| 6 | " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 6.0</font></h1><font face="arial,helvetica,sanserif">Version 6.0.39, Jan 27 2014</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="../images/asf-logo.gif" align="right" alt="Apache Logo" border="0"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade="noshade" size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap="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></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="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="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>Other</strong></p><ul><li><a href="filter.html">Filter</a></li><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>Apache Tomcat Configuration Reference</h1><h2>The Manager Component</h2><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>
|
| 7 | <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>
|
| 8 | </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>
|
| 9 |
|
| 10 | <p>The <strong>Manager</strong> element represents the <em>session
|
| 11 | manager</em> that will be used to create and maintain HTTP sessions
|
| 12 | as requested by the associated web application.</p>
|
| 13 |
|
| 14 | <p>A Manager element MAY be nested inside a
|
| 15 | <a href="context.html">Context</a> component. If it is not included,
|
| 16 | a default Manager configuration will be created automatically, which
|
| 17 | is sufficient for most requirements, — see
|
| 18 | <em>Standard Manager Implementation</em> below for the details
|
| 19 | of this configuration.</p>
|
| 20 |
|
| 21 | </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>
|
| 22 |
|
| 23 | <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>
|
| 24 |
|
| 25 | <p>All implementations of <strong>Manager</strong>
|
| 26 | support the following attributes:</p>
|
| 27 |
|
| 28 | <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>className</code></td><td align="left" valign="center">
|
| 29 | <p>Java class name of the implementation to use. This class must
|
| 30 | implement the <code>org.apache.catalina.Manager</code> interface.
|
| 31 | If not specified, the standard value (defined below) will be used.</p>
|
| 32 | </td></tr><tr><td align="left" valign="center"><code>distributable</code></td><td align="left" valign="center">
|
| 33 | <p>Set to <code>true</code> to ask the session manager to enforce
|
| 34 | the restrictions described in the Servlet Specification on
|
| 35 | distributable applications (primarily, this would mean that all
|
| 36 | session attributes must implement <code>java.io.Serializable</code>).
|
| 37 | Set to <code>false</code> (the default) to not enforce these
|
| 38 | restrictions.</p>
|
| 39 |
|
| 40 | <p><strong>NOTE</strong> - The value for this property is inherited
|
| 41 | automatically based on the presence or absence of the
|
| 42 | <code><distributable></code> element in the web application
|
| 43 | deployment descriptor (<code>/WEB-INF/web.xml</code>).</p>
|
| 44 | </td></tr></table>
|
| 45 |
|
| 46 | </blockquote></td></tr></table>
|
| 47 |
|
| 48 |
|
| 49 | <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>
|
| 50 |
|
| 51 | <p>Tomcat provides two standard implementations of <strong>Manager</strong>
|
| 52 | for use — the default one stores active sessions, while the optional one
|
| 53 | stores active sessions that have been swapped out (in addition to saving
|
| 54 | sessions across a restart of Tomcat) in a storage location that is selected
|
| 55 | via the use of an appropriate <strong>Store</strong> nested element.</p>
|
| 56 |
|
| 57 | <h3>Standard Manager Implementation</h3>
|
| 58 |
|
| 59 | <p>The standard implementation of <strong>Manager</strong> is
|
| 60 | <strong>org.apache.catalina.session.StandardManager</strong>.
|
| 61 | It supports the following additional attributes (in addition to the
|
| 62 | common attributes listed above):</p>
|
| 63 |
|
| 64 | <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>algorithm</code></td><td align="left" valign="center">
|
| 65 | <p>Name of the <em>Message Digest</em> algorithm used to calculate
|
| 66 | session identifiers produced by this Manager. This value must
|
| 67 | be supported by the <code>java.security.MessageDigest</code> class.
|
| 68 | If not specified, the default value is "MD5".</p>
|
| 69 | </td></tr><tr><td align="left" valign="center"><code>entropy</code></td><td align="left" valign="center">
|
| 70 | <p>A String value that is utilized when seeding the random number
|
| 71 | generator used to create session identifiers for this Manager.
|
| 72 | If not specified, a semi-useful value is calculated, but a long
|
| 73 | String value should be specified in security-conscious
|
| 74 | environments.</p>
|
| 75 | </td></tr><tr><td align="left" valign="center"><code>maxActiveSessions</code></td><td align="left" valign="center">
|
| 76 | <p>The maximum number of active sessions that will be created by
|
| 77 | this Manager, or -1 (the default) for no limit.</p>
|
| 78 | </td></tr><tr><td align="left" valign="center"><code>maxInactiveInterval</code></td><td align="left" valign="center">
|
| 79 | <p>The initial maximum time interval, in seconds,
|
| 80 | between client requests before a session is invalidated. A negative value
|
| 81 | will result in sessions never timing out. If the attribute is not provided,
|
| 82 | a default of 60 seconds is used.</p>
|
| 83 |
|
| 84 | <p>This attribute provides the initial value whenever a
|
| 85 | new session is created, but the interval may be dynamically
|
| 86 | varied by a servlet via the
|
| 87 | <code>setMaxInactiveInterval</code> method of the <code>HttpSession</code> object.</p>
|
| 88 | </td></tr><tr><td align="left" valign="center"><code>pathname</code></td><td align="left" valign="center">
|
| 89 | <p>Absolute or relative (to the work directory for this Context)
|
| 90 | pathname of the file in which session state will be preserved
|
| 91 | across application restarts, if possible. The default is
|
| 92 | "SESSIONS.ser".<br>See
|
| 93 | <a href="#Persistence_Across_Restarts">Persistence Across Restarts</a>
|
| 94 | for more information. This persistence may be
|
| 95 | disabled by setting this attribute to an empty string.</p>
|
| 96 | </td></tr><tr><td align="left" valign="center"><code>processExpiresFrequency</code></td><td align="left" valign="center">
|
| 97 | <p>Frequency of the session expiration, and related manager operations.
|
| 98 | Manager operations will be done once for the specified amount of
|
| 99 | backgroundProcess calls (i.e., the lower the amount, the more often the
|
| 100 | checks will occur). The minimum value is 1, and the default value is 6.
|
| 101 | </p>
|
| 102 | </td></tr><tr><td align="left" valign="center"><code>randomClass</code></td><td align="left" valign="center">
|
| 103 | <p>Java class name of the <code>java.util.Random</code>
|
| 104 | implementation class to use. If not specified, the default value is
|
| 105 | <code>java.security.SecureRandom</code>.</p>
|
| 106 | </td></tr><tr><td align="left" valign="center"><code>randomFile</code></td><td align="left" valign="center">
|
| 107 | <p>Name of a file that provides random data that are used to generate
|
| 108 | session ids. If not specified, the default value is
|
| 109 | <code>/dev/urandom</code> on Unix-like systems (those where such
|
| 110 | file path is absolute) and empty on others.</p>
|
| 111 | </td></tr><tr><td align="left" valign="center"><code>sessionIdLength</code></td><td align="left" valign="center">
|
| 112 | <p>The length of session ids created by this Manager, measured in bytes,
|
| 113 | excluding subsequent conversion to a hexadecimal string and
|
| 114 | excluding any JVM route information used for load balancing.
|
| 115 | The default is 16.</p>
|
| 116 | </td></tr></table>
|
| 117 |
|
| 118 | <h3>Persistent Manager Implementation</h3>
|
| 119 |
|
| 120 | <p><em><strong>WARNING - Use of this Manager implementation
|
| 121 | has not been thoroughly tested, and should be considered experimental!
|
| 122 | </strong></em></p>
|
| 123 |
|
| 124 | <p><strong>NOTE:</strong> You must set either the
|
| 125 | <code>org.apache.catalina.session.StandardSession.ACTIVITY_CHECK</code> or
|
| 126 | <code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE</code>
|
| 127 | <a href="systemprops.html">system properties</a> to <code>true</code> for
|
| 128 | the persistent manager to work correctly.</p>
|
| 129 |
|
| 130 | <p>The persistent implementation of <strong>Manager</strong> is
|
| 131 | <strong>org.apache.catalina.session.PersistentManager</strong>. In
|
| 132 | addition to the usual operations of creating and deleting sessions, a
|
| 133 | <code>PersistentManager</code> has the capability to swap active (but
|
| 134 | idle) sessions out to a persistent storage mechanism, as well as to save
|
| 135 | all sessions across a normal restart of Tomcat. The actual persistent
|
| 136 | storage mechanism used is selected by your choice of a
|
| 137 | <strong>Store</strong> element nested inside the <strong>Manager</strong>
|
| 138 | element - this is required for use of <code>PersistentManager</code>.</p>
|
| 139 |
|
| 140 | <p>This implementation of Manager supports the following attributes in
|
| 141 | addition to the <a href="#Common Attributes">Common Attributes</a>
|
| 142 | described earlier.</p>
|
| 143 |
|
| 144 | <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>algorithm</code></td><td align="left" valign="center">
|
| 145 | <p>Name of the <em>Message Digest</em> algorithm used to calculate
|
| 146 | session identifiers produced by this Manager. This value must
|
| 147 | be supported by the <code>java.security.MessageDigest</code> class.
|
| 148 | If not specified, the default value is "MD5".</p>
|
| 149 | </td></tr><tr><td align="left" valign="center"><code>className</code></td><td align="left" valign="center">
|
| 150 | <p>Java class name of the implementation to use. This class must
|
| 151 | implement the <code>org.apache.catalina.Manager</code> interface.
|
| 152 | You <strong>must</strong> specify
|
| 153 | <code>org.apache.catalina.session.PersistentManager</code> to use
|
| 154 | this manager implementation.</p>
|
| 155 | </td></tr><tr><td align="left" valign="center"><code>entropy</code></td><td align="left" valign="center">
|
| 156 | <p>A String value that is utilized when seeding the random number
|
| 157 | generator used to create session identifiers for this Manager.
|
| 158 | If not specified, a semi-useful value is calculated, but a long
|
| 159 | String value should be specified in security-conscious
|
| 160 | environments.</p>
|
| 161 | </td></tr><tr><td align="left" valign="center"><code>maxActiveSessions</code></td><td align="left" valign="center">
|
| 162 | <p>The maximum number of active sessions that will be created by
|
| 163 | this Manager, or -1 (the default) for no limit.</p>
|
| 164 | </td></tr><tr><td align="left" valign="center"><code>maxIdleBackup</code></td><td align="left" valign="center">
|
| 165 | <p>The time interval (in seconds) since the last access to a session
|
| 166 | before it is eligible for being persisted to the session store, or
|
| 167 | <code>-1</code> to disable this feature. By default, this feature is
|
| 168 | disabled.</p>
|
| 169 | </td></tr><tr><td align="left" valign="center"><code>maxIdleSwap</code></td><td align="left" valign="center">
|
| 170 | <p>The time interval (in seconds) since the last access to a session
|
| 171 | before it should be persisted to the session store, and
|
| 172 | passivated out of the server's memory, or <code>-1</code> to disable
|
| 173 | this feature. If this feature is enabled, the time interval specified
|
| 174 | here should be equal to or longer than the value specified for
|
| 175 | <code>maxIdleBackup</code>. By default, this feature is disabled.</p>
|
| 176 | </td></tr><tr><td align="left" valign="center"><code>minIdleSwap</code></td><td align="left" valign="center">
|
| 177 | <p>The time interval (in seconds) since the last access to a session
|
| 178 | before it will be eligible to be persisted to the session store, and
|
| 179 | passivated out of the server's memory, or <code>-1</code> for this
|
| 180 | swapping to be available at any time. If specified, this value should
|
| 181 | be less than that specified by <code>maxIdleSwap</code>. By default,
|
| 182 | this value is set to <code>-1</code>.</p>
|
| 183 | </td></tr><tr><td align="left" valign="center"><code>maxInactiveInterval</code></td><td align="left" valign="center">
|
| 184 | <p>The initial maximum time interval, in seconds,
|
| 185 | between client requests before a session is invalidated. A negative value
|
| 186 | will result in sessions never timing out. If the attribute is not provided,
|
| 187 | a default of 60 seconds is used.</p>
|
| 188 |
|
| 189 | <p>This attribute provides the initial value whenever a
|
| 190 | new session is created, but the interval may be dynamically
|
| 191 | varied by a servlet via the
|
| 192 | <code>setMaxInactiveInterval</code>method of the <code>HttpSession</code> object.</p>
|
| 193 | </td></tr><tr><td align="left" valign="center"><code>randomClass</code></td><td align="left" valign="center">
|
| 194 | <p>Java class name of the <code>java.util.Random</code>
|
| 195 | implementation class to use. If not specified, the default value is
|
| 196 | <code>java.security.SecureRandom</code>.</p>
|
| 197 | </td></tr><tr><td align="left" valign="center"><code>randomFile</code></td><td align="left" valign="center">
|
| 198 | <p>Name of a file that provides random data that are used to generate
|
| 199 | session ids. If not specified, the default value is
|
| 200 | <code>/dev/urandom</code> on Unix-like systems (those where such
|
| 201 | file path is absolute) and empty on others.</p>
|
| 202 | </td></tr><tr><td align="left" valign="center"><code>saveOnRestart</code></td><td align="left" valign="center">
|
| 203 | <p>Should all sessions be persisted and reloaded when Tomcat is shut
|
| 204 | down and restarted (or when this application is reloaded)? By default,
|
| 205 | this attribute is set to <code>true</code>.</p>
|
| 206 | </td></tr><tr><td align="left" valign="center"><code>sessionIdLength</code></td><td align="left" valign="center">
|
| 207 | <p>The length of session ids created by this Manager, measured in bytes,
|
| 208 | excluding subsequent conversion to a hexadecimal string and
|
| 209 | excluding any JVM route information used for load balancing.
|
| 210 | The default is 16.</p>
|
| 211 | </td></tr></table>
|
| 212 |
|
| 213 | <p>In order to successfully use a PersistentManager, you must nest inside
|
| 214 | it a <strong><Store></strong> element, as described below.</p>
|
| 215 |
|
| 216 | </blockquote></td></tr></table>
|
| 217 |
|
| 218 |
|
| 219 | </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>
|
| 220 |
|
| 221 | <h3>Standard Manager Implementation</h3>
|
| 222 |
|
| 223 | <p>If you are using the <em>Standard Manager Implementation</em>
|
| 224 | as described above, no elements may be nested inside your
|
| 225 | <strong><Manager></strong> element.</p>
|
| 226 |
|
| 227 | <h3>Persistent Manager Implementation</h3>
|
| 228 |
|
| 229 | <p>If you are using the <em>Persistent Manager Implementation</em>
|
| 230 | as described above, you <strong>MUST</strong> nest a
|
| 231 | <strong><Store></strong> element inside, which defines the
|
| 232 | characteristics of the persistent data storage. Two implementations
|
| 233 | of the <code><Store></code> element are currently available,
|
| 234 | with different characteristics, as described below.</p>
|
| 235 |
|
| 236 | <h5>File Based Store</h5>
|
| 237 |
|
| 238 | <p>The <em>File Based Store</em> implementation saves swapped out
|
| 239 | sessions in individual files (named based on the session identifier)
|
| 240 | in a configurable directory. Therefore, you are likely to encounter
|
| 241 | scalability problems as the number of active sessions increases, and
|
| 242 | this should primarily be considered a means to easily experiment.</p>
|
| 243 |
|
| 244 | <p>To configure this, add a <code><Store></code> nested inside
|
| 245 | your <code><Manager></code> element with the following attributes:
|
| 246 | </p>
|
| 247 |
|
| 248 | <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>checkInterval</code></td><td align="left" valign="center">
|
| 249 | <p>The interval (in seconds) between checks for expired sessions
|
| 250 | among those sessions that are currently swapped out. By default,
|
| 251 | this interval is set to 60 seconds (one minute).</p>
|
| 252 | </td></tr><tr><td align="left" valign="center"><strong><code>className</code></strong></td><td align="left" valign="center">
|
| 253 | <p>Java class name of the implementation to use. This class must
|
| 254 | implement the <code>org.apache.catalina.Store</code> interface. You
|
| 255 | <strong>must</strong> specify
|
| 256 | <code>org.apache.catalina.session.FileStore</code>
|
| 257 | to use this implementation.</p>
|
| 258 | </td></tr><tr><td align="left" valign="center"><code>directory</code></td><td align="left" valign="center">
|
| 259 | <p>Absolute or relative (to the temporary work directory for this web
|
| 260 | application) pathname of the directory into which individual session
|
| 261 | files are written. If not specified, the temporary work directory
|
| 262 | assigned by the container is utilized.</p>
|
| 263 | </td></tr></table>
|
| 264 |
|
| 265 |
|
| 266 | <h5>JDBC Based Store</h5>
|
| 267 |
|
| 268 | <p>The <em>JDBC Based Store</em> implementation saves swapped out
|
| 269 | sessions in individual rows of a preconfigured table in a database
|
| 270 | that is accessed via a JDBC driver. With large numbers of swapped out
|
| 271 | sessions, this implementation will exhibit improved performance over
|
| 272 | the File Based Store described above.</p>
|
| 273 |
|
| 274 | <p>To configure this, add a <code><Store></code> nested inside
|
| 275 | your <code><Manager></code> element with the following attributes:
|
| 276 | </p>
|
| 277 |
|
| 278 | <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>checkInterval</code></td><td align="left" valign="center">
|
| 279 | <p>The interval (in seconds) between checks for expired sessions
|
| 280 | among those sessions that are currently swapped out. By default,
|
| 281 | this interval is set to 60 seconds (one minute).</p>
|
| 282 | </td></tr><tr><td align="left" valign="center"><strong><code>className</code></strong></td><td align="left" valign="center">
|
| 283 | <p>Java class name of the implementation to use. This class must
|
| 284 | implement the <code>org.apache.catalina.Store</code> interface. You
|
| 285 | <strong>must</strong> specify
|
| 286 | <code>org.apache.catalina.session.JDBCStore</code>
|
| 287 | to use this implementation.</p>
|
| 288 | </td></tr><tr><td align="left" valign="center"><strong><code>connectionURL</code></strong></td><td align="left" valign="center">
|
| 289 | <p>The connection URL that will be handed to the configured JDBC
|
| 290 | driver to establish a connection to the database containing our
|
| 291 | session table.</p>
|
| 292 | </td></tr><tr><td align="left" valign="center"><strong><code>driverName</code></strong></td><td align="left" valign="center">
|
| 293 | <p>Java class name of the JDBC driver to be used.</p>
|
| 294 | </td></tr><tr><td align="left" valign="center"><strong><code>sessionAppCol</code></strong></td><td align="left" valign="center">
|
| 295 | <p>Name of the database column, contained in the specified session
|
| 296 | table, that contains the Engine, Host, and Web Application Context
|
| 297 | name in the format <code>/Engine/Host/Context</code>.</p>
|
| 298 | </td></tr><tr><td align="left" valign="center"><strong><code>sessionDataCol</code></strong></td><td align="left" valign="center">
|
| 299 | <p>Name of the database column, contained in the specified
|
| 300 | session table, that contains the serialized form of all session
|
| 301 | attributes for a swapped out session. The column type must accept
|
| 302 | a binary object (typically called a BLOB).</p>
|
| 303 | </td></tr><tr><td align="left" valign="center"><strong><code>sessionIdCol</code></strong></td><td align="left" valign="center">
|
| 304 | <p>Name of the database column, contained in the specified
|
| 305 | session table, that contains the session identifier of the
|
| 306 | swapped out session. The column type must accept character
|
| 307 | string data of at least as many characters as are contained
|
| 308 | in session identifiers created by Tomcat (typically 32).</p>
|
| 309 | </td></tr><tr><td align="left" valign="center"><strong><code>sessionLastAccessedCol</code></strong></td><td align="left" valign="center">
|
| 310 | <p>Name of the database column, contained in the specified
|
| 311 | session table, that contains the <code>lastAccessedTime</code>
|
| 312 | property of this session. The column type must accept a
|
| 313 | Java <code>long</code> (64 bits).</p>
|
| 314 | </td></tr><tr><td align="left" valign="center"><strong><code>sessionMaxInactiveCol</code></strong></td><td align="left" valign="center">
|
| 315 | <p>Name of the database column, contained in the specified
|
| 316 | session table, that contains the <code>maxInactiveInterval</code>
|
| 317 | property of this session. The column type must accept a
|
| 318 | Java <code>integer</code> (32 bits).</p>
|
| 319 | </td></tr><tr><td align="left" valign="center"><strong><code>sessionTable</code></strong></td><td align="left" valign="center">
|
| 320 | <p>Name of the database table to be used for storing swapped out
|
| 321 | sessions. This table must contain (at least) the database columns
|
| 322 | that are configured by the other attributes of this element.</p>
|
| 323 | </td></tr><tr><td align="left" valign="center"><strong><code>sessionValidCol</code></strong></td><td align="left" valign="center">
|
| 324 | <p>Name of the database column, contained in the specified
|
| 325 | session table, that contains a flag indicating whether this
|
| 326 | swapped out session is still valid or not. The column type
|
| 327 | must accept a single character.</p>
|
| 328 | </td></tr></table>
|
| 329 |
|
| 330 | <p>Before attempting to use the JDBC Based Store for the first time,
|
| 331 | you must create the table that will be used to store swapped out sessions.
|
| 332 | Detailed SQL commands vary depending on the database you are using, but
|
| 333 | a script like this will generally be required:</p>
|
| 334 |
|
| 335 | <div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre>
|
| 336 | create table tomcat_sessions (
|
| 337 | session_id varchar(100) not null primary key,
|
| 338 | valid_session char(1) not null,
|
| 339 | max_inactive int not null,
|
| 340 | last_access bigint not null,
|
| 341 | app_name varchar(255),
|
| 342 | session_data mediumblob,
|
| 343 | KEY kapp_name(app_name)
|
| 344 | );
|
| 345 | </pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
|
| 346 |
|
| 347 | <p>In order for the JDBC Based Store to successfully connect to your
|
| 348 | database, the JDBC driver you configure must be visible to Tomcat's
|
| 349 | internal class loader. Generally, that means you must place the JAR
|
| 350 | file containing this driver into the <code>$CATALINA_HOME/lib</code>
|
| 351 | directory.</p>
|
| 352 |
|
| 353 | </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>
|
| 354 |
|
| 355 |
|
| 356 | <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>
|
| 357 |
|
| 358 | <p>Whenever Apache Tomcat is shut down normally and restarted, or when an
|
| 359 | application reload is triggered, the standard Manager implementation
|
| 360 | will attempt to serialize all currently active sessions to a disk
|
| 361 | file located via the <code>pathname</code> attribute. All such saved
|
| 362 | sessions will then be deserialized and activated (assuming they have
|
| 363 | not expired in the mean time) when the application reload is completed.</p>
|
| 364 |
|
| 365 | <p>In order to successfully restore the state of session attributes,
|
| 366 | all such attributes MUST implement the <code>java.io.Serializable</code>
|
| 367 | interface. You MAY cause the Manager to enforce this restriction by
|
| 368 | including the <code><distributable></code> element in your web
|
| 369 | application deployment descriptor (<code>/WEB-INF/web.xml</code>).</p>
|
| 370 |
|
| 371 | </blockquote></td></tr></table>
|
| 372 |
|
| 373 | <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>
|
| 374 |
|
| 375 | <p>As documented above, every web application by default has
|
| 376 | standard manager implementation configured, and it performs session
|
| 377 | persistence across restarts. To disable this persistence feature, create
|
| 378 | a <a href="context.html">Context</a> configuration file for your web
|
| 379 | application and add the following element there:</p>
|
| 380 |
|
| 381 | <div align="left"><table cellspacing="4" cellpadding="0" border="0"><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#ffffff" height="1"><pre><Manager pathname="" /></pre></td><td bgcolor="#023264" width="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr><tr><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td><td bgcolor="#023264" width="1" height="1"><img src="../images/void.gif" alt="" width="1" height="1" vspace="0" hspace="0" border="0"></td></tr></table></div>
|
| 382 | </blockquote></td></tr></table>
|
| 383 |
|
| 384 | </blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade="noshade" size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
|
| 385 | Copyright © 1999-2014, Apache Software Foundation
|
| 386 | </em></font></div></td></tr></table></body></html> |