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