Eric Berry wrote:
> Mark, thanks for the reply.
> 
> You appear to have misunderstood. Which part of the doc did you get this
>> from and I'll see if it can be made clearer.
> 
> 
>>From my understanding of the the order of precedence.
> 
> [quote]
> 
> *Context* elements may be explicitly defined:
> 
>    - in the $CATALINA_HOME/conf/context.xml file: the Context element
>    information will be loaded by all webapps
>    - in the 
> $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.defaultfile:
> the Context element information will be loaded by all webapps of that
>    host
>    - in individual files (with a ".xml" extension) in the
>    $CATALINA_HOME/conf/[enginename]/[hostname]/ 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. context#path.xml. The default
>    web application may be defined by using a file called ROOT.xml.
>    - if the previous file was not found for this application, in an
>    individual file at /META-INF/context.xml inside the application files
>    - inside a 
> Host<http://tomcat.apache.org/tomcat-5.5-doc/config/host.html>element
> in the main
>    conf/server.xml
> 
> [/quote]

Your original post referred to the context path. If you read further down
in the description of the path element:
<quote>
The value of this field must not be set except when statically defining a
Context in server.xml, as it will be inferred from the filenames used for
either the .xml context file or the docBase.
</quote>


> I thought this means that if there isn't a context for this webapp in
> $CATALINA_HOME/conf/context.xml, or in
> $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default, or just in
> the [hostname] directory, then it would use the context defined in the web
> application META-INF/context.xml.

That isn't quite how it works.
$CATALINA_HOME/conf/context.xml
provides global defaults which can be overridden at the host level by:
$CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.defaultfile
which in turn can be overridden at the context level by:
$CATALINA_HOME/conf/[enginename]/[hostname]/<contextpath>.xml

If a <contextpath>.xml exists, it always takes priority over anything in a
WAR or an exploded directory.

> Is there a different handling for packaged webapps (wars) vs. an exploded
> directory?
There is a slight one. For WARs with a context.xml, it will get copied to
$CATALINA_HOME/conf/[enginename]/[hostname]/ if a <contextpath>.xml does
not exist.
context.xml files in an exploded directory do not get copied. This is an
inconsistency that is on my list to fix as part of fixing
https://issues.apache.org/bugzilla/show_bug.cgi?id=42747

Mark



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to