Author: kkolinko
Date: Sun Mar 17 04:15:23 2013
New Revision: 1457371

URL: http://svn.apache.org/r1457371
Log:
CTR: docs   Note: updates the stylesheet
Backport improvements to introductory section of Context document
Includes backport of markup for "detail-table" table variant,
used by "Naming" section here.

Modified:
    tomcat/tc6.0.x/trunk/webapps/docs/config/context.xml
    tomcat/tc6.0.x/trunk/webapps/docs/tomcat-docs.xsl

Modified: tomcat/tc6.0.x/trunk/webapps/docs/config/context.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/config/context.xml?rev=1457371&r1=1457370&r2=1457371&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/config/context.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/config/context.xml Sun Mar 17 04:15:23 
2013
@@ -64,46 +64,113 @@
   directory hierarchy).</p>
 
   <p>You may define as many <strong>Context</strong> elements as you
-  wish.  Each such Context MUST have a unique context path. In
+  wish.  Each such Context MUST have a unique context path within a virtual
+  host. In
   addition, a Context must be present with a context path equal to
   a zero-length string.  This Context becomes the <em>default</em>
   web application for this virtual host, and is used to process all
   requests that do not match any other Context's context path.</p>
 
-  <p><b>For Tomcat 6, unlike Tomcat 4.x, it is NOT recommended to place
+  <subsection name="Naming">
+  <p>When <code>autoDeploy</code> or <code>deployOnStartup</code> operations
+  are performed by a Host, the web application is specified by a context XML
+  file in <a href="host.html">Host</a>&apos;s <code>xmlBase</code>
+  directory or by a WAR file or a directory file in Host&apos;s
+  <code>appBase</code> directory.
+  In this case the context path is derived from the name of the file that
+  is being deployed. Consequently, the context path <strong>may not</strong>
+  be defined in a <code>META-INF/context.xml</code> embedded in
+  the application. There is, therefore, a close relationship between the
+  <em>context path</em> and
+  the <em>base file name</em> (the name minus <code>.war</code> or
+  <code>.xml</code> extension) of the file.</p>
+
+  <p>Let us assume that you want to deploy your application to respond to
+  requests to URIs starting with certain context path. According to the
+  Servlet specification, the context path may be an empty string, or a
+  string starting with '/'. The rules to define the names for this context
+  path are the following:</p>
+
+  <ul>
+    <li>If the context path is a zero length string, the <em>base name</em> is
+    <code>"ROOT"</code> (uppercase)</li>
+    <li>If the context path is not a zero length string, the <em>base
+    name</em> is the context path with the leading '/' removed and any
+    remaining '/' characters in the path replaced with '#'.</li>
+  </ul>
+
+  <p>To help clarify these rules, some examples are given in the following
+  table.</p>
+
+  <table class="detail-table">
+    <tr>
+      <th>Context Path</th>
+      <th>Base File Name</th>
+    </tr>
+    <tr><td>/foo</td><td>foo</td></tr>
+    <tr>
+      <td>/foo/bar</td><td>foo#bar</td>
+    </tr>
+    <tr>
+      <td><i>Empty String</i></td>
+      <td>ROOT</td>
+    </tr>
+  </table>
+
+  <p>If you want to deploy a WAR file or a directory using a context path that
+  is not related to the base file name then one of the following options must
+  be used to prevent double-deployment:
+  </p>
+  <ul>
+  <li>Disable autoDeploy and deployOnStartup and define all
+  <strong>Context</strong>s in server.xml</li>
+  <li>Locate the WAR and/or directory outside of the Host&apos;s appBase and 
use
+      a context.xml file with a docBase attribute to define it.</li>
+  </ul>
+  </subsection>
+
+  <subsection name="Defining a context">
+  <p><b>It is NOT recommended to place
   &lt;Context&gt; elements directly in the server.xml file.</b> This
   is because it makes modifying the <strong>Context</strong> configuration
   more invasive since the main <code>conf/server.xml</code> file cannot be
   reloaded without restarting Tomcat.</p>
 
-  <p><strong>Context</strong> elements may be explicitly defined:
+  <p>Individual <strong>Context</strong> elements may be explicitly defined:
+  </p>
   <ul>
-  <li>In the <code>$CATALINA_BASE/conf/context.xml</code> file: 
-  the Context element information will be loaded by all webapps.</li>
-  <li>In the 
-  <code>$CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.default</code>
-  file: the Context element information will be loaded by all webapps of that
-  host.</li>
+  <li>In an individual file at <code>/META-INF/context.xml</code> inside the
+  application files. In Tomcat 6 this file is automatically copied to
+  <code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code> and renamed to
+  application&apos;s base file name plus a ".xml" extension.
+  (This automated copying became optional in Tomcat 7).
+  </li>
   <li>In individual files (with a ".xml" extension) in the
   <code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code> directory.
-  The name of the file (less the .xml extension) will be used as the
-  context path. Multi-level context paths may be defined using #, e.g.
-  <code>foo#bar.xml</code> for a context path of <code>/foo/bar</code>. The
-  default web application may be defined by using a file called
-  <code>ROOT.xml</code>.</li>
-  <li>Only if a context file does not exist for the application in the 
-  <code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code>, in an individual
-  file at <code>/META-INF/context.xml</code> inside the application files. If
-  the web application is packaged as a WAR then
-  <code>/META-INF/context.xml</code> will be copied to
-  <code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code> and renamed to
-  match the application's context path. Once this file exists, it will not be
-  replaced if a new WAR with a newer <code>/META-INF/context.xml</code> is
-  placed in the host's appBase.</li>
+  The context path will be derived from the base name of the file
+  (the file name less the .xml extension). This file will always take 
precedence
+  over any context.xml file packaged in the web application&apos;s META-INF
+  directory.</li>
   <li>Inside a <a href="host.html">Host</a> element in the main
   <code>conf/server.xml</code>.</li>
   </ul>
+
+  <p>Default <strong>Context</strong> elements may be defined that apply to
+  multiple web applications. Configuration for an individual web application
+  will override anything configured in one of these defaults. Any nested
+  elements, e.g. &lt;Resource&gt; elements, that are defined in a default
+  <strong>Context</strong> will be created once for each
+  <strong>Context</strong> to which the default applies. They will <b>not</b> 
be
+  shared between <strong>Context</strong> elements.
   </p>
+  <ul>
+  <li>In the <code>$CATALINA_BASE/conf/context.xml</code> file:
+  the Context element information will be loaded by all web applications.</li>
+  <li>In the
+  <code>$CATALINA_BASE/conf/[enginename]/[hostname]/context.xml.default</code>
+  file: the Context element information will be loaded by all web applications
+  of that host.</li>
+  </ul>
 
   <p>With the exception of server.xml, files that define <strong>Context
   </strong> elements may only define a single <strong>Context</strong> element.
@@ -111,11 +178,17 @@
 
   <p>In addition to explicitly specified Context elements, there are
   several techniques by which Context elements can be created automatically
-  for you.  See <a href="host.html#Automatic Application Deployment">
+  for you.  See <a href="host.html#Automatic_Application_Deployment">
   Automatic Application Deployment</a> and
-  <a href="host.html#User Web Applications">User Web Applications</a>
+  <a href="host.html#User_Web_Applications">User Web Applications</a>
   for more information.</p>
 
+  <p>To define multiple contexts that use a single WAR file or directory,
+  use one of the options described in the <a href="#Naming">Naming</a>
+  section above for creating a <strong>Context</strong> that has a path
+  that is not related to the base file name.</p>
+  </subsection>
+
 </section>
 
 

Modified: tomcat/tc6.0.x/trunk/webapps/docs/tomcat-docs.xsl
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/tomcat-docs.xsl?rev=1457371&r1=1457370&r2=1457371&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/tomcat-docs.xsl (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/tomcat-docs.xsl Sun Mar 17 04:15:23 2013
@@ -520,6 +520,28 @@
       <a href="{$link}">r<xsl:apply-templates/></a>
   </xsl:template>
 
+  <!-- specially process td tags ala site.vsl -->
+  <xsl:template match="table[@class='detail-table']/tr/td">
+    <td bgcolor="{$table-td-bg}" valign="top" align="left">
+        <xsl:if test="@colspan"><xsl:attribute name="colspan"><xsl:value-of 
select="@colspan"/></xsl:attribute></xsl:if>
+        <xsl:if test="@rowspan"><xsl:attribute name="rowspan"><xsl:value-of 
select="@rowspan"/></xsl:attribute></xsl:if>
+        <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+            <xsl:apply-templates/>
+        </font>
+    </td>
+  </xsl:template>
+
+  <!-- handle th ala site.vsl -->
+  <xsl:template match="table[@class='detail-table']/tr/th">
+    <td bgcolor="{$table-th-bg}" valign="top">
+        <xsl:if test="@colspan"><xsl:attribute name="colspan"><xsl:value-of 
select="@colspan"/></xsl:attribute></xsl:if>
+        <xsl:if test="@rowspan"><xsl:attribute name="rowspan"><xsl:value-of 
select="@rowspan"/></xsl:attribute></xsl:if>
+        <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+            <xsl:apply-templates />
+        </font>
+    </td>
+  </xsl:template>
+
   <!-- Process everything else by just passing it through -->
   <xsl:template match="*|@*">
     <xsl:copy>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to