| [66] | 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat Configuration Reference - The Context Container</title><meta value="Craig R. McClanahan" name="author"><meta value="craigmcc@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 Context Container</h2></td><td nowrap="true" valign="top" align="right"><small><a href="printer/context.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 | <blockquote><em> | 
|---|
|  | 7 | <p>The description below uses the variable name $CATALINA_BASE to refer the | 
|---|
|  | 8 | base directory against which most relative paths are resolved. If you have | 
|---|
|  | 9 | not configured Tomcat 6 for multiple instances by setting a CATALINA_BASE | 
|---|
|  | 10 | directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME, | 
|---|
|  | 11 | the directory into which you have installed Tomcat 6.</p> | 
|---|
|  | 12 | </em></blockquote> | 
|---|
|  | 13 |  | 
|---|
|  | 14 | <p>The <strong>Context</strong> element represents a <em>web | 
|---|
|  | 15 | application</em>, which is run within a particular virtual host. | 
|---|
|  | 16 | Each web application is based on a <em>Web Application Archive</em> | 
|---|
|  | 17 | (WAR) file, or a corresponding directory containing the corresponding | 
|---|
|  | 18 | unpacked contents, as described in the Servlet Specification (version | 
|---|
|  | 19 | 2.2 or later).  For more information about web application archives, | 
|---|
|  | 20 | you can download the | 
|---|
|  | 21 | <a href="http://java.sun.com/products/servlet/download.html">Servlet | 
|---|
|  | 22 | Specification</a>, and review the Tomcat | 
|---|
|  | 23 | <a href="../appdev/index.html">Application Developer's Guide</a>.</p> | 
|---|
|  | 24 |  | 
|---|
|  | 25 | <p>The web application used to process each HTTP request is selected | 
|---|
|  | 26 | by Catalina based on matching the longest possible prefix of the | 
|---|
|  | 27 | Request URI against the <em>context path</em> of each defined Context. | 
|---|
|  | 28 | Once selected, that Context will select an appropriate servlet to | 
|---|
|  | 29 | process the incoming request, according to the servlet mappings defined | 
|---|
|  | 30 | in the <em>web application deployment descriptor</em> file (which MUST | 
|---|
|  | 31 | be located at <code>/WEB-INF/web.xml</code> within the web app's | 
|---|
|  | 32 | directory hierarchy).</p> | 
|---|
|  | 33 |  | 
|---|
|  | 34 | <p>You may define as many <strong>Context</strong> elements as you | 
|---|
|  | 35 | wish.  Each such Context MUST have a unique context path. In | 
|---|
|  | 36 | addition, a Context must be present with a context path equal to | 
|---|
|  | 37 | a zero-length string.  This Context becomes the <em>default</em> | 
|---|
|  | 38 | web application for this virtual host, and is used to process all | 
|---|
|  | 39 | requests that do not match any other Context's context path.</p> | 
|---|
|  | 40 |  | 
|---|
|  | 41 | <p><b>For Tomcat 6, unlike Tomcat 4.x, it is NOT recommended to place | 
|---|
|  | 42 | <Context> elements directly in the server.xml file.</b> This | 
|---|
|  | 43 | is because it makes modifing the <strong>Context</strong> configuration | 
|---|
|  | 44 | more invasive since the main <code>conf/server.xml</code> file cannot be | 
|---|
|  | 45 | reloaded without restarting Tomcat.</p> | 
|---|
|  | 46 |  | 
|---|
|  | 47 | <p><strong>Context</strong> elements may be explicitly defined: | 
|---|
|  | 48 | <ul> | 
|---|
|  | 49 | <li>in the <code>$CATALINA_BASE/conf/context.xml</code> file: | 
|---|
|  | 50 | the Context element information will be loaded by all webapps</li> | 
|---|
|  | 51 | <li>in the | 
|---|
|  | 52 | <code>$CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.default</code> | 
|---|
|  | 53 | file: the Context element information will be loaded by all webapps of that | 
|---|
|  | 54 | host</li> | 
|---|
|  | 55 | <li>in individual files (with a ".xml" extension) in the | 
|---|
|  | 56 | <code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code> directory. | 
|---|
|  | 57 | The name of the file (less the .xml extension) will be used as the | 
|---|
|  | 58 | context path. Multi-level context paths may be defined using #, e.g. | 
|---|
|  | 59 | <code>context#path.xml</code>. The default web application may be defined | 
|---|
|  | 60 | by using a file called <code>ROOT.xml</code>.</li> | 
|---|
|  | 61 | <li>if the previous file was not found for this application, in an individual | 
|---|
|  | 62 | file at <code>/META-INF/context.xml</code> inside the application files</li> | 
|---|
|  | 63 | <li>inside a <a href="host.html">Host</a> element in the main | 
|---|
|  | 64 | <code>conf/server.xml</code></li> | 
|---|
|  | 65 | </ul> | 
|---|
|  | 66 | </p> | 
|---|
|  | 67 |  | 
|---|
|  | 68 | <p>With the exception of server.xml, files that define <strong>Context | 
|---|
|  | 69 | </strong> elements may only define a single <strong>Context</strong> element. | 
|---|
|  | 70 | </p> | 
|---|
|  | 71 |  | 
|---|
|  | 72 | <p>In addition to explicitly specified Context elements, there are | 
|---|
|  | 73 | several techniques by which Context elements can be created automatically | 
|---|
|  | 74 | for you.  See <a href="host.html#Automatic Application Deployment"> | 
|---|
|  | 75 | Automatic Application Deployment</a> and | 
|---|
|  | 76 | <a href="host.html#User Web Applications">User Web Applications</a> | 
|---|
|  | 77 | for more information.</p> | 
|---|
|  | 78 |  | 
|---|
|  | 79 | </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> | 
|---|
|  | 80 |  | 
|---|
|  | 81 | <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> | 
|---|
|  | 82 |  | 
|---|
|  | 83 | <p>All implementations of <strong>Context</strong> | 
|---|
|  | 84 | support the following attributes:</p> | 
|---|
|  | 85 |  | 
|---|
|  | 86 | <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>backgroundProcessorDelay</code></td><td valign="center" align="left"> | 
|---|
|  | 87 | <p>This value represents the delay in seconds between the | 
|---|
|  | 88 | invocation of the backgroundProcess method on this context and | 
|---|
|  | 89 | its child containers, including all wrappers. | 
|---|
|  | 90 | Child containers will not be invoked if their delay value is not | 
|---|
|  | 91 | negative (which would mean they are using their own processing | 
|---|
|  | 92 | thread). Setting this to a positive value will cause | 
|---|
|  | 93 | a thread to be spawn. After waiting the specified amount of time, | 
|---|
|  | 94 | the thread will invoke the backgroundProcess method on this host | 
|---|
|  | 95 | and all its child containers. A context will use background | 
|---|
|  | 96 | processing to perform session expiration and class monitoring for | 
|---|
|  | 97 | reloading. If not specified, the default value for this attribute is | 
|---|
|  | 98 | -1, which means the context will rely on the background processing | 
|---|
|  | 99 | thread of its parent host.</p> | 
|---|
|  | 100 | </td></tr><tr><td valign="center" align="left"><code>className</code></td><td valign="center" align="left"> | 
|---|
|  | 101 | <p>Java class name of the implementation to use.  This class must | 
|---|
|  | 102 | implement the <code>org.apache.catalina.Context</code> interface. | 
|---|
|  | 103 | If not specified, the standard value (defined below) will be used.</p> | 
|---|
|  | 104 | </td></tr><tr><td valign="center" align="left"><code>cookies</code></td><td valign="center" align="left"> | 
|---|
|  | 105 | <p>Set to <code>true</code> if you want cookies to be used for | 
|---|
|  | 106 | session identifier communication if supported by the client (this | 
|---|
|  | 107 | is the default).  Set to <code>false</code> if you want to disable | 
|---|
|  | 108 | the use of cookies for session identifier communication, and rely | 
|---|
|  | 109 | only on URL rewriting by the application.</p> | 
|---|
|  | 110 | </td></tr><tr><td valign="center" align="left"><code>crossContext</code></td><td valign="center" align="left"> | 
|---|
|  | 111 | <p>Set to <code>true</code> if you want calls within this application | 
|---|
|  | 112 | to <code>ServletContext.getContext()</code> to successfully return a | 
|---|
|  | 113 | request dispatcher for other web applications running on this virtual | 
|---|
|  | 114 | host.  Set to <code>false</code> (the default) in security | 
|---|
|  | 115 | conscious environments, to make <code>getContext()</code> always | 
|---|
|  | 116 | return <code>null</code>.</p> | 
|---|
|  | 117 | </td></tr><tr><td valign="center" align="left"><strong><code>docBase</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 118 | <p>The <em>Document Base</em> (also known as the <em>Context | 
|---|
|  | 119 | Root</em>) directory for this web application, or the pathname | 
|---|
|  | 120 | to the web application archive file (if this web application is | 
|---|
|  | 121 | being executed directly from the WAR file). You may specify | 
|---|
|  | 122 | an absolute pathname for this directory or WAR file, or a pathname | 
|---|
|  | 123 | that is relative to the <code>appBase</code> directory of the | 
|---|
|  | 124 | owning <a href="host.html">Host</a>.</p> | 
|---|
|  | 125 | <p>The value of this field must not be set when the Context is | 
|---|
|  | 126 | configured using a <code>META-INF/context.xml</code> file as it will be | 
|---|
|  | 127 | inferred by the automatic deployment process.</p> | 
|---|
|  | 128 | </td></tr><tr><td valign="center" align="left"><code>override</code></td><td valign="center" align="left"> | 
|---|
|  | 129 | <p>Set to <code>true</code> to have explicit settings in this | 
|---|
|  | 130 | Context element override any corresponding settings in the | 
|---|
|  | 131 | <a href="defaultcontext.html">DefaultContext</a> element associated | 
|---|
|  | 132 | with our owning <a href="host.html">Host</a>.  By default, settings | 
|---|
|  | 133 | in the DefaultContext element will be used.</p> | 
|---|
|  | 134 | <p>If a symbolic link is used for docBase then changes to the | 
|---|
|  | 135 | symbolic link will only be effective after a Tomcat restart or | 
|---|
|  | 136 | by undeploying and redeploying the conext. A context reload is not | 
|---|
|  | 137 | sufficient.</p> | 
|---|
|  | 138 | </td></tr><tr><td valign="center" align="left"><code>privileged</code></td><td valign="center" align="left"> | 
|---|
|  | 139 | <p>Set to <code>true</code> to allow this context to use container | 
|---|
|  | 140 | servlets, like the manager servlet. Use of the <code>privileged</code> | 
|---|
|  | 141 | attribute will change the context's parent class loader to be the | 
|---|
|  | 142 | <em>Server</em> class loader rather than the <em>Shared</em> class | 
|---|
|  | 143 | loader. Note that in a default installation, the <em>Common</em> class | 
|---|
|  | 144 | loader is used for both the <em>Server</em> and the <em>Shared</em> | 
|---|
|  | 145 | class loaders.</p> | 
|---|
|  | 146 | </td></tr><tr><td valign="center" align="left"><code>path</code></td><td valign="center" align="left"> | 
|---|
|  | 147 | <p>The <em>context path</em> of this web application, which is | 
|---|
|  | 148 | matched against the beginning of each request URI to select the | 
|---|
|  | 149 | appropriate web application for processing.  All of the context paths | 
|---|
|  | 150 | within a particular <a href="host.html">Host</a> must be unique. | 
|---|
|  | 151 | If you specify a context path of an empty string (""), you are | 
|---|
|  | 152 | defining the <em>default</em> web application for this Host, which | 
|---|
|  | 153 | will process all requests not assigned to other Contexts.</p> | 
|---|
|  | 154 | <p>The value of this field must not be set except when statically | 
|---|
|  | 155 | defining a Context in server.xml, as it will be inferred from the | 
|---|
|  | 156 | filenames used for either the .xml context file or the docBase.</p> | 
|---|
|  | 157 | </td></tr><tr><td valign="center" align="left"><code>reloadable</code></td><td valign="center" align="left"> | 
|---|
|  | 158 | <p>Set to <code>true</code> if you want Catalina to monitor classes in | 
|---|
|  | 159 | <code>/WEB-INF/classes/</code> and <code>/WEB-INF/lib</code> for | 
|---|
|  | 160 | changes, and automatically reload the web application if a change | 
|---|
|  | 161 | is detected.  This feature is very useful during application | 
|---|
|  | 162 | development, but it requires significant runtime overhead and is | 
|---|
|  | 163 | not recommended for use on deployed production applications.  That's | 
|---|
|  | 164 | why the default setting for this attribute is <i>false</i>.  You | 
|---|
|  | 165 | can use the <a href="../manager-howto.html">Manager</a> web | 
|---|
|  | 166 | application, however, to trigger reloads of deployed applications | 
|---|
|  | 167 | on demand.</p> | 
|---|
|  | 168 | </td></tr><tr><td valign="center" align="left"><code>wrapperClass</code></td><td valign="center" align="left"> | 
|---|
|  | 169 | <p>Java class name of the <code>org.apache.catalina.Wrapper</code> | 
|---|
|  | 170 | implementation class that will be used for servlets managed by this | 
|---|
|  | 171 | Context.  If not specified, a standard default value will be used.</p> | 
|---|
|  | 172 | </td></tr></table> | 
|---|
|  | 173 |  | 
|---|
|  | 174 | </blockquote></td></tr></table> | 
|---|
|  | 175 |  | 
|---|
|  | 176 |  | 
|---|
|  | 177 | <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> | 
|---|
|  | 178 |  | 
|---|
|  | 179 | <p>The standard implementation of <strong>Context</strong> is | 
|---|
|  | 180 | <strong>org.apache.catalina.core.StandardContext</strong>. | 
|---|
|  | 181 | It supports the following additional attributes (in addition to the | 
|---|
|  | 182 | common attributes listed above):</p> | 
|---|
|  | 183 |  | 
|---|
|  | 184 | <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>allowLinking</code></td><td valign="center" align="left"> | 
|---|
|  | 185 | <p>If the value of this flag is <code>true</code>, symlinks will be | 
|---|
|  | 186 | allowed inside the web application, pointing to resources outside the | 
|---|
|  | 187 | web application base path. If not specified, the default value | 
|---|
|  | 188 | of the flag is <code>false</code>.</p> | 
|---|
|  | 189 | <p><b>NOTE: This flag MUST NOT be set to true on the Windows platform | 
|---|
|  | 190 | (or any other OS which does not have a case sensitive filesystem), | 
|---|
|  | 191 | as it will disable case sensitivity checks, allowing JSP source code | 
|---|
|  | 192 | disclosure, among other security problems.</b></p> | 
|---|
|  | 193 | </td></tr><tr><td valign="center" align="left"><code>antiJARLocking</code></td><td valign="center" align="left"> | 
|---|
|  | 194 | <p>If true, the Tomcat classloader will take extra measures to avoid | 
|---|
|  | 195 | JAR file locking when resources are accessed inside JARs through URLs. | 
|---|
|  | 196 | This will impact startup time of applications, but could prove to be useful | 
|---|
|  | 197 | on platforms or configurations where file locking can occur. | 
|---|
|  | 198 | If not specified, the default value is <code>false</code>.</p> | 
|---|
|  | 199 | </td></tr><tr><td valign="center" align="left"><code>antiResourceLocking</code></td><td valign="center" align="left"> | 
|---|
|  | 200 | <p>If true, Tomcat will prevent any file locking. | 
|---|
|  | 201 | This will significantly impact startup time of applications, | 
|---|
|  | 202 | but allows full webapp hot deploy and undeploy on platforms | 
|---|
|  | 203 | or configurations where file locking can occur. | 
|---|
|  | 204 | If not specified, the default value is <code>false</code>.</p> | 
|---|
|  | 205 |  | 
|---|
|  | 206 | <p>Please note that setting this to <code>true</code> has some side effects, | 
|---|
|  | 207 | including the disabling of JSP reloading in a running server: see | 
|---|
|  | 208 | <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=37668">Bugzilla 37668</a>. | 
|---|
|  | 209 | </p> | 
|---|
|  | 210 |  | 
|---|
|  | 211 | <p> | 
|---|
|  | 212 | Please note that setting this flag to true in applications that are | 
|---|
|  | 213 | outside the appBase for the Host (the <code>webapps</code> directory | 
|---|
|  | 214 | by default) will cause the application to be | 
|---|
|  | 215 | <strong>deleted</strong> on Tomcat shutdown.  You probably don't want to | 
|---|
|  | 216 | do this, so think twice before setting antiResourceLocking=true on a webapp | 
|---|
|  | 217 | that's outside the appBase for its Host. | 
|---|
|  | 218 | </p> | 
|---|
|  | 219 | </td></tr><tr><td valign="center" align="left"><code>cacheMaxSize</code></td><td valign="center" align="left"> | 
|---|
|  | 220 | <p>Maximum size of the static resource cache in kilobytes. | 
|---|
|  | 221 | If not specified, the default value is <code>10240</code> | 
|---|
|  | 222 | (10 megabytes).</p> | 
|---|
|  | 223 | </td></tr><tr><td valign="center" align="left"><code>cacheTTL</code></td><td valign="center" align="left"> | 
|---|
|  | 224 | <p>Amount of time in milliseconds between cache entries revalidation. | 
|---|
|  | 225 | If not specified, the default value is <code>5000</code> | 
|---|
|  | 226 | (5 seconds).</p> | 
|---|
|  | 227 | </td></tr><tr><td valign="center" align="left"><code>cachingAllowed</code></td><td valign="center" align="left"> | 
|---|
|  | 228 | <p>If the value of this flag is <code>true</code>, the cache for static | 
|---|
|  | 229 | resources will be used. If not specified, the default value | 
|---|
|  | 230 | of the flag is <code>true</code>.</p> | 
|---|
|  | 231 | </td></tr><tr><td valign="center" align="left"><code>caseSensitive</code></td><td valign="center" align="left"> | 
|---|
|  | 232 | <p>If the value of this flag is <code>true</code>, all case sensitivity | 
|---|
|  | 233 | checks will be disabled. If not | 
|---|
|  | 234 | specified, the default value of the flag is <code>true</code>.</p> | 
|---|
|  | 235 | <p><b>NOTE: This flag MUST NOT be set to false on the Windows platform | 
|---|
|  | 236 | (or any other OS which does not have a case sensitive filesystem), | 
|---|
|  | 237 | as it will disable case sensitivity checks, allowing JSP source code | 
|---|
|  | 238 | disclosure, among other security problems.</b></p> | 
|---|
|  | 239 | </td></tr><tr><td valign="center" align="left"><code>processTlds</code></td><td valign="center" align="left"> | 
|---|
|  | 240 | <p>Whether the context should process TLDs on startup.  The default | 
|---|
|  | 241 | is true.  The false setting is intended for special cases | 
|---|
|  | 242 | that know in advance TLDs are not part of the webapp.</p> | 
|---|
|  | 243 | </td></tr><tr><td valign="center" align="left"><code>swallowOutput</code></td><td valign="center" align="left"> | 
|---|
|  | 244 | <p>If the value of this flag is <code>true</code>, the bytes output to | 
|---|
|  | 245 | System.out and System.err by the web application will be redirected to | 
|---|
|  | 246 | the web application logger. If not specified, the default value | 
|---|
|  | 247 | of the flag is <code>false</code>.</p> | 
|---|
|  | 248 | </td></tr><tr><td valign="center" align="left"><code>tldNamespaceAware</code></td><td valign="center" align="left"> | 
|---|
|  | 249 | <p>If the value of this flag is <code>true</code>, the TLD files | 
|---|
|  | 250 | XML validation will be namespace-aware.  If you turn this flag on, | 
|---|
|  | 251 | you should probably also turn <code>tldValidation</code> on.  The | 
|---|
|  | 252 | default value for this flag is <code>false</code>, and setting it | 
|---|
|  | 253 | to true will incur a performance penalty. | 
|---|
|  | 254 | </p> | 
|---|
|  | 255 | </td></tr><tr><td valign="center" align="left"><code>tldValidation</code></td><td valign="center" align="left"> | 
|---|
|  | 256 | <p>If the value of this flag is <code>true</code>, the TLD files | 
|---|
|  | 257 | will be XML validated on context startup.  The default value for | 
|---|
|  | 258 | this flag is <code>false</code>, and setting it to true will incur | 
|---|
|  | 259 | a performance penalty.</p> | 
|---|
|  | 260 | </td></tr><tr><td valign="center" align="left"><code>unloadDelay</code></td><td valign="center" align="left"> | 
|---|
|  | 261 | <p>Amount of ms that the container will wait for servlets to unload. | 
|---|
|  | 262 | If not specified, the default value of the flag is <code>2000</code> | 
|---|
|  | 263 | ms.</p> | 
|---|
|  | 264 | </td></tr><tr><td valign="center" align="left"><code>unpackWAR</code></td><td valign="center" align="left"> | 
|---|
|  | 265 | <p>If true, Tomcat will unpack all compressed web applications before | 
|---|
|  | 266 | running them. | 
|---|
|  | 267 | If not specified, the default value is <code>true</code>.</p> | 
|---|
|  | 268 | </td></tr><tr><td valign="center" align="left"><code>useNaming</code></td><td valign="center" align="left"> | 
|---|
|  | 269 | <p>Set to <code>true</code> (the default) to have Catalina enable a | 
|---|
|  | 270 | JNDI <code>InitialContext</code> for this web application that is | 
|---|
|  | 271 | compatible with Java2 Enterprise Edition (J2EE) platform | 
|---|
|  | 272 | conventions.</p> | 
|---|
|  | 273 | </td></tr><tr><td valign="center" align="left"><code>workDir</code></td><td valign="center" align="left"> | 
|---|
|  | 274 | <p>Pathname to a scratch directory to be provided by this Context | 
|---|
|  | 275 | for temporary read-write use by servlets within the associated web | 
|---|
|  | 276 | application.  This directory will be made visible to servlets in the | 
|---|
|  | 277 | web application by a servlet context attribute (of type | 
|---|
|  | 278 | <code>java.io.File</code>) named | 
|---|
|  | 279 | <code>javax.servlet.context.tempdir</code> as described in the | 
|---|
|  | 280 | Servlet Specification.  If not specified, a suitable directory | 
|---|
|  | 281 | underneath <code>$CATALINA_BASE/work</code> will be provided.</p> | 
|---|
|  | 282 | </td></tr></table> | 
|---|
|  | 283 |  | 
|---|
|  | 284 | </blockquote></td></tr></table> | 
|---|
|  | 285 |  | 
|---|
|  | 286 |  | 
|---|
|  | 287 | </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> | 
|---|
|  | 288 |  | 
|---|
|  | 289 | <p>You can nest at most one instance of the following utility components | 
|---|
|  | 290 | by nesting a corresponding element inside your <strong>Context</strong> | 
|---|
|  | 291 | element:</p> | 
|---|
|  | 292 | <ul> | 
|---|
|  | 293 | <li><a href="loader.html"><strong>Loader</strong></a> - | 
|---|
|  | 294 | Configure the web application class loader that will be used to load | 
|---|
|  | 295 | servlet and bean classes for this web application.  Normally, the | 
|---|
|  | 296 | default configuration of the class loader will be sufficient.</li> | 
|---|
|  | 297 | <li><a href="manager.html"><strong>Manager</strong></a> - | 
|---|
|  | 298 | Configure the session manager that will be used to create, destroy, | 
|---|
|  | 299 | and persist HTTP sessions for this web application.  Normally, the | 
|---|
|  | 300 | default configuration of the session manager will be sufficient.</li> | 
|---|
|  | 301 | <li><a href="realm.html"><strong>Realm</strong></a> - | 
|---|
|  | 302 | Configure a realm that will allow its | 
|---|
|  | 303 | database of users, and their associated roles, to be utilized solely | 
|---|
|  | 304 | for this particular web application.  If not specified, this web | 
|---|
|  | 305 | application will utilize the Realm associated with the owning | 
|---|
|  | 306 | <a href="host.html">Host</a> or <a href="engine.html">Engine</a>.</li> | 
|---|
|  | 307 | <li><a href="resources.html"><strong>Resources</strong></a> - | 
|---|
|  | 308 | Configure the resource manager that will be used to access the static | 
|---|
|  | 309 | resources associated with this web application.  Normally, the | 
|---|
|  | 310 | default configuration of the resource manager will be sufficient.</li> | 
|---|
|  | 311 | <li><strong>WatchedResource</strong> - The auto deployer will monitor the | 
|---|
|  | 312 | specified static resource of the web application for updates, and will | 
|---|
|  | 313 | reload the web application if is is updated. The content of this element | 
|---|
|  | 314 | must be a string.</li> | 
|---|
|  | 315 | </ul> | 
|---|
|  | 316 |  | 
|---|
|  | 317 | </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> | 
|---|
|  | 318 |  | 
|---|
|  | 319 |  | 
|---|
|  | 320 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Logging"><strong>Logging</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 321 |  | 
|---|
|  | 322 | <p>A context is associated with the | 
|---|
|  | 323 | <code>org.apache.catalina.core.ContainerBase.[enginename].[hostname].[path]</code> | 
|---|
|  | 324 | log category.  Note that the brackets are actually part of the name, don't omit them.</p> | 
|---|
|  | 325 |  | 
|---|
|  | 326 | </blockquote></td></tr></table> | 
|---|
|  | 327 |  | 
|---|
|  | 328 |  | 
|---|
|  | 329 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Access Logs"><strong>Access Logs</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 330 |  | 
|---|
|  | 331 | <p>When you run a web server, one of the output files normally generated | 
|---|
|  | 332 | is an <em>access log</em>, which generates one line of information for | 
|---|
|  | 333 | each request processed by the server, in a standard format.  Catalina | 
|---|
|  | 334 | includes an optional <a href="valve.html">Valve</a> implementation that | 
|---|
|  | 335 | can create access logs in the same standard format created by web servers, | 
|---|
|  | 336 | or in any number of custom formats.</p> | 
|---|
|  | 337 |  | 
|---|
|  | 338 | <p>You can ask Catalina to create an access log for all requests | 
|---|
|  | 339 | processed by an <a href="engine.html">Engine</a>, | 
|---|
|  | 340 | <a href="host.html">Host</a>, or <a href="context.html">Context</a> | 
|---|
|  | 341 | by nesting a <a href="valve.html">Valve</a> element like this:</p> | 
|---|
|  | 342 |  | 
|---|
|  | 343 | <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> | 
|---|
|  | 344 | <Context path="/examples" ...> | 
|---|
|  | 345 | ... | 
|---|
|  | 346 | <Valve className="org.apache.catalina.valves.AccessLogValve" | 
|---|
|  | 347 | prefix="localhost_access_log." suffix=".txt" | 
|---|
|  | 348 | pattern="common"/> | 
|---|
|  | 349 | ... | 
|---|
|  | 350 | </Context> | 
|---|
|  | 351 | </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> | 
|---|
|  | 352 |  | 
|---|
|  | 353 | <p>See <a href="valve.html#Access Log Valve">Access Log Valve</a> | 
|---|
|  | 354 | for more information on the configuration attributes that are | 
|---|
|  | 355 | supported.</p> | 
|---|
|  | 356 |  | 
|---|
|  | 357 | </blockquote></td></tr></table> | 
|---|
|  | 358 |  | 
|---|
|  | 359 |  | 
|---|
|  | 360 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Automatic Context Configuration"><strong>Automatic Context Configuration</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 361 |  | 
|---|
|  | 362 | <p>If you use the standard <strong>Context</strong> implementation, | 
|---|
|  | 363 | the following configuration steps occur automtically when Catalina | 
|---|
|  | 364 | is started, or whenever this web application is reloaded.  No special | 
|---|
|  | 365 | configuration is required to enable this feature.</p> | 
|---|
|  | 366 |  | 
|---|
|  | 367 | <ul> | 
|---|
|  | 368 | <li>If you have not declared your own <a href="loader.html">Loader</a> | 
|---|
|  | 369 | element, a standard web application class loader will be configured. | 
|---|
|  | 370 | </li> | 
|---|
|  | 371 | <li>If you have not declared your own <a href="manager.html">Manager</a> | 
|---|
|  | 372 | element, a standard session manager will be configured.</li> | 
|---|
|  | 373 | <li>If you have not declared your own <a href="resources.html">Resources</a> | 
|---|
|  | 374 | element, a standard resources manager will be configured.</li> | 
|---|
|  | 375 | <li>The web application properties listed in <code>conf/web.xml</code> | 
|---|
|  | 376 | will be processed as defaults for this web application.  This is used | 
|---|
|  | 377 | to establish default mappings (such as mapping the <code>*.jsp</code> | 
|---|
|  | 378 | extension to the corresponding JSP servlet), and other standard | 
|---|
|  | 379 | features that apply to all web applications.</li> | 
|---|
|  | 380 | <li>The web application properties listed in the | 
|---|
|  | 381 | <code>/WEB-INF/web.xml</code> resource for this web application | 
|---|
|  | 382 | will be processed (if this resource exists).</li> | 
|---|
|  | 383 | <li>If your web application has specified security constraints that might | 
|---|
|  | 384 | require user authentication, an appropriate Authenticator that | 
|---|
|  | 385 | implements the login method you have selected will be configured.</li> | 
|---|
|  | 386 | </ul> | 
|---|
|  | 387 |  | 
|---|
|  | 388 | </blockquote></td></tr></table> | 
|---|
|  | 389 |  | 
|---|
|  | 390 |  | 
|---|
|  | 391 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Context Parameters"><strong>Context Parameters</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 392 |  | 
|---|
|  | 393 | <p>You can configure named values that will be made visible to the | 
|---|
|  | 394 | web application as servlet context initialization parameters by nesting | 
|---|
|  | 395 | <code><Parameter></code> elements inside this element.  For | 
|---|
|  | 396 | example, you can create an initialization parameter like this:</p> | 
|---|
|  | 397 | <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> | 
|---|
|  | 398 | <Context ...> | 
|---|
|  | 399 | ... | 
|---|
|  | 400 | <Parameter name="companyName" value="My Company, Incorporated" | 
|---|
|  | 401 | override="false"/> | 
|---|
|  | 402 | ... | 
|---|
|  | 403 | </Context> | 
|---|
|  | 404 | </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> | 
|---|
|  | 405 |  | 
|---|
|  | 406 | <p>This is equivalent to the inclusion of the following element in the | 
|---|
|  | 407 | web application deployment descriptor (<code>/WEB-INF/web.xml</code>): | 
|---|
|  | 408 | </p> | 
|---|
|  | 409 | <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> | 
|---|
|  | 410 | <context-param> | 
|---|
|  | 411 | <param-name>companyName</param-name> | 
|---|
|  | 412 | <param-value>My Company, Incorporated</param-value> | 
|---|
|  | 413 | </context-param> | 
|---|
|  | 414 | </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> | 
|---|
|  | 415 | <p>but does <em>not</em> require modification of the deployment descriptor | 
|---|
|  | 416 | to customize this value.</p> | 
|---|
|  | 417 |  | 
|---|
|  | 418 | <p>The valid attributes for a <code><Parameter></code> element | 
|---|
|  | 419 | are as follows:</p> | 
|---|
|  | 420 |  | 
|---|
|  | 421 | <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>description</code></td><td valign="center" align="left"> | 
|---|
|  | 422 | <p>Optional, human-readable description of this context | 
|---|
|  | 423 | initialization parameter.</p> | 
|---|
|  | 424 | </td></tr><tr><td valign="center" align="left"><strong><code>name</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 425 | <p>The name of the context initialization parameter to be created.</p> | 
|---|
|  | 426 | </td></tr><tr><td valign="center" align="left"><code>override</code></td><td valign="center" align="left"> | 
|---|
|  | 427 | <p>Set this to <code>false</code> if you do <strong>not</strong> want | 
|---|
|  | 428 | a <code><context-param></code> for the same parameter name, | 
|---|
|  | 429 | found in the web application deployment descriptor, to override the | 
|---|
|  | 430 | value specified here.  By default, overrides are allowed.</p> | 
|---|
|  | 431 | </td></tr><tr><td valign="center" align="left"><strong><code>value</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 432 | <p>The parameter value that will be presented to the application | 
|---|
|  | 433 | when requested by calling | 
|---|
|  | 434 | <code>ServletContext.getInitParameter()</code>.</p> | 
|---|
|  | 435 | </td></tr></table> | 
|---|
|  | 436 |  | 
|---|
|  | 437 | </blockquote></td></tr></table> | 
|---|
|  | 438 |  | 
|---|
|  | 439 |  | 
|---|
|  | 440 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Environment Entries"><strong>Environment Entries</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 441 |  | 
|---|
|  | 442 | <p>You can configure named values that will be made visible to the | 
|---|
|  | 443 | web application as environment entry resources, by nesting | 
|---|
|  | 444 | <code><Environment></code> entries inside this element.  For | 
|---|
|  | 445 | example, you can create an environment entry like this:</p> | 
|---|
|  | 446 | <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> | 
|---|
|  | 447 | <Context ...> | 
|---|
|  | 448 | ... | 
|---|
|  | 449 | <Environment name="maxExemptions" value="10" | 
|---|
|  | 450 | type="java.lang.Integer" override="false"/> | 
|---|
|  | 451 | ... | 
|---|
|  | 452 | </Context> | 
|---|
|  | 453 | </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> | 
|---|
|  | 454 |  | 
|---|
|  | 455 | <p>This is equivalent to the inclusion of the following element in the | 
|---|
|  | 456 | web application deployment descriptor (<code>/WEB-INF/web.xml</code>): | 
|---|
|  | 457 | </p> | 
|---|
|  | 458 | <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> | 
|---|
|  | 459 | <env-entry> | 
|---|
|  | 460 | <env-entry-name>maxExemptions</param-name> | 
|---|
|  | 461 | <env-entry-value>10</env-entry-value> | 
|---|
|  | 462 | <env-entry-type>java.lang.Integer</env-entry-type> | 
|---|
|  | 463 | </env-entry> | 
|---|
|  | 464 | </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> | 
|---|
|  | 465 | <p>but does <em>not</em> require modification of the deployment descriptor | 
|---|
|  | 466 | to customize this value.</p> | 
|---|
|  | 467 |  | 
|---|
|  | 468 | <p>The valid attributes for an <code><Environment></code> element | 
|---|
|  | 469 | are as follows:</p> | 
|---|
|  | 470 |  | 
|---|
|  | 471 | <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>description</code></td><td valign="center" align="left"> | 
|---|
|  | 472 | <p>Optional, human-readable description of this environment entry.</p> | 
|---|
|  | 473 | </td></tr><tr><td valign="center" align="left"><strong><code>name</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 474 | <p>The name of the environment entry to be created, relative to the | 
|---|
|  | 475 | <code>java:comp/env</code> context.</p> | 
|---|
|  | 476 | </td></tr><tr><td valign="center" align="left"><code>override</code></td><td valign="center" align="left"> | 
|---|
|  | 477 | <p>Set this to <code>false</code> if you do <strong>not</strong> want | 
|---|
|  | 478 | an <code><env-entry></code> for the same environment entry name, | 
|---|
|  | 479 | found in the web application deployment descriptor, to override the | 
|---|
|  | 480 | value specified here.  By default, overrides are allowed.</p> | 
|---|
|  | 481 | </td></tr><tr><td valign="center" align="left"><strong><code>type</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 482 | <p>The fully qualified Java class name expected by the web application | 
|---|
|  | 483 | for this environment entry.  Must be one of the legal values for | 
|---|
|  | 484 | <code><env-entry-type></code> in the web application deployment | 
|---|
|  | 485 | descriptor:  <code>java.lang.Boolean</code>, | 
|---|
|  | 486 | <code>java.lang.Byte</code>, <code>java.lang.Character</code>, | 
|---|
|  | 487 | <code>java.lang.Double</code>, <code>java.lang.Float</code>, | 
|---|
|  | 488 | <code>java.lang.Integer</code>, <code>java.lang.Long</code>, | 
|---|
|  | 489 | <code>java.lang.Short</code>, or <code>java.lang.String</code>.</p> | 
|---|
|  | 490 | </td></tr><tr><td valign="center" align="left"><strong><code>value</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 491 | <p>The parameter value that will be presented to the application | 
|---|
|  | 492 | when requested from the JNDI context.  This value must be convertable | 
|---|
|  | 493 | to the Java type defined by the <code>type</code> attribute.</p> | 
|---|
|  | 494 | </td></tr></table> | 
|---|
|  | 495 |  | 
|---|
|  | 496 | </blockquote></td></tr></table> | 
|---|
|  | 497 |  | 
|---|
|  | 498 |  | 
|---|
|  | 499 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Lifecycle Listeners"><strong>Lifecycle Listeners</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 500 |  | 
|---|
|  | 501 | <p>If you have implemented a Java object that needs to know when this | 
|---|
|  | 502 | <strong>Context</strong> is started or stopped, you can declare it by | 
|---|
|  | 503 | nesting a <strong>Listener</strong> element inside this element.  The | 
|---|
|  | 504 | class name you specify must implement the | 
|---|
|  | 505 | <code>org.apache.catalina.LifecycleListener</code> interface, and | 
|---|
|  | 506 | the class must be packaged in a jar and placed in the | 
|---|
|  | 507 | <code>$CATALINA_HOME/lib</code> directory. | 
|---|
|  | 508 | It will be notified about the occurrence of the corresponding | 
|---|
|  | 509 | lifecycle events.  Configuration of such a listener looks like this:</p> | 
|---|
|  | 510 |  | 
|---|
|  | 511 | <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> | 
|---|
|  | 512 | <Context path="/examples" ...> | 
|---|
|  | 513 | ... | 
|---|
|  | 514 | <Listener className="com.mycompany.mypackage.MyListener" ... > | 
|---|
|  | 515 | ... | 
|---|
|  | 516 | </Context> | 
|---|
|  | 517 | </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> | 
|---|
|  | 518 |  | 
|---|
|  | 519 | <p>Note that a Listener can have any number of additional properties | 
|---|
|  | 520 | that may be configured from this element.  Attribute names are matched | 
|---|
|  | 521 | to corresponding JavaBean property names using the standard property | 
|---|
|  | 522 | method naming patterns.</p> | 
|---|
|  | 523 |  | 
|---|
|  | 524 | </blockquote></td></tr></table> | 
|---|
|  | 525 |  | 
|---|
|  | 526 |  | 
|---|
|  | 527 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Request Filters"><strong>Request Filters</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 528 |  | 
|---|
|  | 529 | <p>You can ask Catalina to check the IP address, or host name, on every | 
|---|
|  | 530 | incoming request directed to the surrounding | 
|---|
|  | 531 | <a href="engine.html">Engine</a>, <a href="host.html">Host</a>, or | 
|---|
|  | 532 | <a href="context.html">Context</a> element.  The remote address or name | 
|---|
|  | 533 | will be checked against a configured list of "accept" and/or "deny" | 
|---|
|  | 534 | filters, which are defined using the Regular Expression syntax supported | 
|---|
|  | 535 | by the <a href="http://jakarta.apache.org/regexp/">Jakarta Regexp</a> | 
|---|
|  | 536 | regular expression library.  Requests that come from locations that are | 
|---|
|  | 537 | not accepted will be rejected with an HTTP "Forbidden" error. | 
|---|
|  | 538 | Example filter declarations:</p> | 
|---|
|  | 539 |  | 
|---|
|  | 540 | <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> | 
|---|
|  | 541 | <Context path="/examples" ...> | 
|---|
|  | 542 | ... | 
|---|
|  | 543 | <Valve className="org.apache.catalina.valves.RemoteHostValve" | 
|---|
|  | 544 | allow="*.mycompany.com,www.yourcompany.com"/> | 
|---|
|  | 545 | <Valve className="org.apache.catalina.valves.RemoteAddrValve" | 
|---|
|  | 546 | deny="192.168.1.*"/> | 
|---|
|  | 547 | ... | 
|---|
|  | 548 | </Context> | 
|---|
|  | 549 | </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> | 
|---|
|  | 550 |  | 
|---|
|  | 551 | <p>See <a href="valve.html#Remote Address Filter">Remote Address Filter</a> | 
|---|
|  | 552 | and <a href="valve.html#Remote Host Filter">Remote Host Filter</a> for | 
|---|
|  | 553 | more information about the configuration options that are supported.</p> | 
|---|
|  | 554 |  | 
|---|
|  | 555 | </blockquote></td></tr></table> | 
|---|
|  | 556 |  | 
|---|
|  | 557 |  | 
|---|
|  | 558 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Resource Definitions"><strong>Resource Definitions</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 559 |  | 
|---|
|  | 560 | <p>You can declare the characteristics of the resource | 
|---|
|  | 561 | to be returned for JNDI lookups of <code><resource-ref></code> and | 
|---|
|  | 562 | <code><resource-env-ref></code> elements in the web application | 
|---|
|  | 563 | deployment descriptor.  You <strong>MUST</strong> also define | 
|---|
|  | 564 | the needed resource parameters as attributes of the <code>Resource</code> | 
|---|
|  | 565 | element, to configure the object factory to be used (if not known to Tomcat | 
|---|
|  | 566 | already), and the properties used to configure that object factory.</p> | 
|---|
|  | 567 |  | 
|---|
|  | 568 | <p>For example, you can create a resource definition like this:</p> | 
|---|
|  | 569 | <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> | 
|---|
|  | 570 | <Context ...> | 
|---|
|  | 571 | ... | 
|---|
|  | 572 | <Resource name="jdbc/EmployeeDB" auth="Container" | 
|---|
|  | 573 | type="javax.sql.DataSource" | 
|---|
|  | 574 | description="Employees Database for HR Applications"/> | 
|---|
|  | 575 | ... | 
|---|
|  | 576 | </Context> | 
|---|
|  | 577 | </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> | 
|---|
|  | 578 |  | 
|---|
|  | 579 | <p>This is equivalent to the inclusion of the following element in the | 
|---|
|  | 580 | web application deployment descriptor (<code>/WEB-INF/web.xml</code>):</p> | 
|---|
|  | 581 | <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> | 
|---|
|  | 582 | <resource-ref> | 
|---|
|  | 583 | <description>Employees Database for HR Applications</description> | 
|---|
|  | 584 | <res-ref-name>jdbc/EmployeeDB</res-ref-name> | 
|---|
|  | 585 | <res-ref-type>javax.sql.DataSource</res-ref-type> | 
|---|
|  | 586 | <res-auth>Container</res-auth> | 
|---|
|  | 587 | </resource-ref> | 
|---|
|  | 588 | </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> | 
|---|
|  | 589 |  | 
|---|
|  | 590 | <p>but does <em>not</em> require modification of the deployment | 
|---|
|  | 591 | descriptor to customize this value.</p> | 
|---|
|  | 592 |  | 
|---|
|  | 593 | <p>The valid attributes for a <code><Resource></code> element | 
|---|
|  | 594 | are as follows:</p> | 
|---|
|  | 595 |  | 
|---|
|  | 596 | <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>auth</code></td><td valign="center" align="left"> | 
|---|
|  | 597 | <p>Specify whether the web Application code signs on to the | 
|---|
|  | 598 | corresponding resource manager programatically, or whether the | 
|---|
|  | 599 | Container will sign on to the resource manager on behalf of the | 
|---|
|  | 600 | application.  The value of this attribute must be | 
|---|
|  | 601 | <code>Application</code> or <code>Container</code>.  This | 
|---|
|  | 602 | attribute is <strong>required</strong> if the web application | 
|---|
|  | 603 | will use a <code><resource-ref></code> element in the web | 
|---|
|  | 604 | application deployment descriptor, but is optional if the | 
|---|
|  | 605 | application uses a <code><resource-env-ref></code> instead.</p> | 
|---|
|  | 606 | </td></tr><tr><td valign="center" align="left"><code>description</code></td><td valign="center" align="left"> | 
|---|
|  | 607 | <p>Optional, human-readable description of this resource.</p> | 
|---|
|  | 608 | </td></tr><tr><td valign="center" align="left"><strong><code>name</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 609 | <p>The name of the resource to be created, relative to the | 
|---|
|  | 610 | <code>java:comp/env</code> context.</p> | 
|---|
|  | 611 | </td></tr><tr><td valign="center" align="left"><code>scope</code></td><td valign="center" align="left"> | 
|---|
|  | 612 | <p>Specify whether connections obtained through this resource | 
|---|
|  | 613 | manager can be shared.  The value of this attribute must be | 
|---|
|  | 614 | <code>Shareable</code> or <code>Unshareable</code>.  By default, | 
|---|
|  | 615 | connections are assumed to be shareable.</p> | 
|---|
|  | 616 | </td></tr><tr><td valign="center" align="left"><strong><code>type</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 617 | <p>The fully qualified Java class name expected by the web | 
|---|
|  | 618 | application when it performs a lookup for this resource.</p> | 
|---|
|  | 619 | </td></tr></table> | 
|---|
|  | 620 |  | 
|---|
|  | 621 |  | 
|---|
|  | 622 | </blockquote></td></tr></table> | 
|---|
|  | 623 |  | 
|---|
|  | 624 |  | 
|---|
|  | 625 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Resource Links"><strong>Resource Links</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 626 |  | 
|---|
|  | 627 | <p>This element is used to create a link to a global JNDI resource. Doing | 
|---|
|  | 628 | a JNDI lookup on the link name will then return the linked global | 
|---|
|  | 629 | resource.</p> | 
|---|
|  | 630 |  | 
|---|
|  | 631 | <p>For example, you can create a resource link like this:</p> | 
|---|
|  | 632 | <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> | 
|---|
|  | 633 | <Context ...> | 
|---|
|  | 634 | ... | 
|---|
|  | 635 | <ResourceLink name="linkToGlobalResource" | 
|---|
|  | 636 | global="simpleValue" | 
|---|
|  | 637 | type="java.lang.Integer" | 
|---|
|  | 638 | ... | 
|---|
|  | 639 | </Context> | 
|---|
|  | 640 | </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> | 
|---|
|  | 641 |  | 
|---|
|  | 642 | <p>The valid attributes for a <code><ResourceLink></code> element | 
|---|
|  | 643 | are as follows:</p> | 
|---|
|  | 644 |  | 
|---|
|  | 645 | <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"><strong><code>global</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 646 | <p>The name of the linked global resource in the | 
|---|
|  | 647 | global JNDI context.</p> | 
|---|
|  | 648 | </td></tr><tr><td valign="center" align="left"><strong><code>name</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 649 | <p>The name of the resource link to be created, relative to the | 
|---|
|  | 650 | <code>java:comp/env</code> context.</p> | 
|---|
|  | 651 | </td></tr><tr><td valign="center" align="left"><strong><code>type</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 652 | <p>The fully qualified Java class name expected by the web | 
|---|
|  | 653 | application when it performs a lookup for this resource link.</p> | 
|---|
|  | 654 | </td></tr></table> | 
|---|
|  | 655 |  | 
|---|
|  | 656 | </blockquote></td></tr></table> | 
|---|
|  | 657 |  | 
|---|
|  | 658 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Transaction"><strong>Transaction</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
|  | 659 |  | 
|---|
|  | 660 | <p>You can declare the characteristics of the UserTransaction | 
|---|
|  | 661 | to be returned for JNDI lookup for <code>java:comp/UserTransaction</code>. | 
|---|
|  | 662 | You <strong>MUST</strong> define an object factory class to instantiate | 
|---|
|  | 663 | this object as well as the needed resource parameters as attributes of the | 
|---|
|  | 664 | <code>Transaction</code> | 
|---|
|  | 665 | element, and the properties used to configure that object factory.</p> | 
|---|
|  | 666 |  | 
|---|
|  | 667 | <p>The valid attributes for the <code><Transaction></code> element | 
|---|
|  | 668 | are as follows:</p> | 
|---|
|  | 669 |  | 
|---|
|  | 670 | <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"><strong><code>factory</code></strong></td><td valign="center" align="left"> | 
|---|
|  | 671 | <p>The class name for the JNDI object factory.</p> | 
|---|
|  | 672 | </td></tr></table> | 
|---|
|  | 673 |  | 
|---|
|  | 674 | </blockquote></td></tr></table> | 
|---|
|  | 675 |  | 
|---|
|  | 676 | </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> | 
|---|
|  | 677 | Copyright © 1999-2008, Apache Software Foundation | 
|---|
|  | 678 | </em></font></div></td></tr></table></body></html> | 
|---|