source: nutchez-0.1/tomcat/webapps/docs/config/printer/manager.html @ 95

Last change on this file since 95 was 66, checked in by waue, 16 years ago

NutchEz - an easy way to nutch

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