I first changed my configuration as follows, moving what was under
"public_html" under "root".

<Host name="katchconstructionsupply.com" appBase="/home/katch/apps">
<Context path="" docBase="/home/katch/apps/root" />

This works, and the <url-pattern> does take precedence again over
directories of the same name as the pattern, which is good.

However, looking at the Tomcat Manager, my web app now appears twice, once
under "/root" and again under "/". That makes sense if the directories under
the appBase are now automatically added as Contexts.

So, why not just do the following instead, where emptyAppBase is an empty
directory?

<Host name="katchconstructionsupply.com" appBase="/home/katch/emptyAppBase">
<Context path="" docBase="/home/katch/public_html" />

I guess I don't understand the purpose or benefit of automatically adding
directories under appBase as Contexts. What am I missing? I have too many
URL patterns established as bookmarks on clients to change the Context's
path from "".

On a related issue, although url-patterns taking precedence over directories
now works for me again, password protecting directories that are part of the
<url-pattern> no longer works. For example, password-protecting the
directory "/office" and then having "/office" as a <url-pattern> for a
servlet, previously caused the client to be required to provide the password
and then the servlet would proceed to handle the request. Now, however
Tomcat is handling the request completely bypasses any password on a
directory of the same name. Does this sound like correct behavior?

-Tad


-----Original Message-----
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: Saturday, December 29, 2007 5:28 PM
To: Tomcat Users List
Subject: Re: Does a static directory now always take precedence to a
url-pattern?

Tad Woods wrote:
> <Host name="katchconstructionsupply.com"
appBase="/home/katch/public_html">
> <Context path="" docBase="/home/katch/public_html" />
> </Host>

Thought so.

> ...this was the same configuration that I ran in 5.5.14.
> 
> Something that may be related and seems odd to me is that if I go into the
> Tomcat Application Manager all of the static directories under the base
are
> listed as applications.  ....my host told me today that this was an
> intentional design change to Tomcat at version 5.5.17?? Not sure I believe
> that.

Your host is sort of correct. The full answer is that using the same
directory for appBase and docBase is an invalid configuration that has
never been supported. That it worked at all in earlier versions was an
unintentional side-effect of a bug that has since been fixed.

Any directory found in the appBase is now treated as a context. This is to
align Tomcat 5 with Tomcat 6 (which is required to do this by the 2.5
servlet spec)

Assuming you only want a single context then a possible configuration would
be:

<Host name="katchconstructionsupply.com" appBase="/home/katch/appBase">
</Host>

And move the contents of /home/katch/public_html to /home/katch/appBase/ROOT

Note that the Context element is unnecessary given your example above.

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]



---------------------------------------------------------------------
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