You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Tim Funk <fu...@joedog.org> on 2003/07/25 12:59:44 UTC

[5] welcome files not compliant?

The default tomcat install has a welcome file list of:
index.html
index.htm
index.jsp

On a HEAD build with no changes to ROOT webapp - all is OK. But if I create a 
file index.html, then index.jsp still gets served.

On a (very)quick glance of the mapper, I see rule 4 and 6:
// Rule 4 -- Welcome resources processing for servlets
// Rule 6 -- Welcome resources processing for physical folder

This leads me to believe that servlets get served as welcome files before 
physical files can be served which doesn't follow the order constaint.

As a bonus question: Do we still need any welcome file processing anymore in 
default servlet since the decoding is done in the mapper? Or can the default 
servlet immediately return the directory listing (or forbidden) on directory 
match?

-Tim


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5] welcome files not compliant?

Posted by Remy Maucherat <re...@apache.org>.
Tim Funk wrote:
> [Permit me to be blockheaded for a moment. I really want to understand 
> this one since it seems it can really confuse users in a test vs 
> production environment]
> 
> So if the webapp is precompiled I get one behavior, and if its not 
> precompiled I get another behavior? (Scary)
> 
> In tomcat's root webapp, the servlet mapping is
> <url-pattern>/index.jsp</url-pattern>
> 
> If the incoming url is "/". I thought this would trigger the welcome 
> file logic to take place. The "container" will then look for any URI as 
> defined by section 11.1 in the order defined by the welcome file list. 
> The default from the tomcat's web.xml being:
> /index.html
> /index.htm
> /index.jsp
> 
> In my case, index.html exists, so it should be served before index.jsp.
> 
>  From 9.10 [Proposed Final Draft August 5th 2002]
> The web server must append each welcome file in the order specified in 
> the deployment descriptor to the partial request and check whether a 
> resource in the WAR is mapped to that request URI. The web container 
> must send the request to the first resource in the WAR that matches. The 
> match is determined using the usual path mapping rules in Section 11.1.
> 
> Am I missing something more subtle?

Ok, you are right, it is not affected by the mapping priorities. 
However, nobody sane should care ;-)

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5] welcome files not compliant?

Posted by Tim Funk <fu...@joedog.org>.
[Permit me to be blockheaded for a moment. I really want to understand this 
one since it seems it can really confuse users in a test vs production 
environment]

So if the webapp is precompiled I get one behavior, and if its not 
precompiled I get another behavior? (Scary)

In tomcat's root webapp, the servlet mapping is
<url-pattern>/index.jsp</url-pattern>

If the incoming url is "/". I thought this would trigger the welcome file 
logic to take place. The "container" will then look for any URI as defined by 
section 11.1 in the order defined by the welcome file list. The default from 
the tomcat's web.xml being:
/index.html
/index.htm
/index.jsp

In my case, index.html exists, so it should be served before index.jsp.

 From 9.10 [Proposed Final Draft August 5th 2002]
The web server must append each welcome file in the order specified in the 
deployment descriptor to the partial request and check whether a resource in 
the WAR is mapped to that request URI. The web container must send the 
request to the first resource in the WAR that matches. The match is 
determined using the usual path mapping rules in Section 11.1.

Am I missing something more subtle?

-Tim

Remy Maucherat wrote:
> No, I disagree with that. This is an exact match on a servlet (don't 
> forget the webapp is precompiled, so there's a real mapping in web.xml 
> in the root webapp), which takes precedence (the physical resource 
> welcome file maps to the "/" servlet, so it has lowest priority).
> 
> Remy
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5] welcome files not compliant?

Posted by Remy Maucherat <re...@apache.org>.
Tim Funk wrote:

> The default tomcat install has a welcome file list of:
> index.html
> index.htm
> index.jsp
> 
> On a HEAD build with no changes to ROOT webapp - all is OK. But if I 
> create a file index.html, then index.jsp still gets served.
> 
> On a (very)quick glance of the mapper, I see rule 4 and 6:
> // Rule 4 -- Welcome resources processing for servlets
> // Rule 6 -- Welcome resources processing for physical folder
> 
> This leads me to believe that servlets get served as welcome files 
> before physical files can be served which doesn't follow the order 
> constaint.
> 
> As a bonus question: Do we still need any welcome file processing 
> anymore in default servlet since the decoding is done in the mapper? Or 
> can the default servlet immediately return the directory listing (or 
> forbidden) on directory match?

No, I disagree with that. This is an exact match on a servlet (don't 
forget the webapp is precompiled, so there's a real mapping in web.xml 
in the root webapp), which takes precedence (the physical resource 
welcome file maps to the "/" servlet, so it has lowest priority).

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5] welcome files not compliant?

Posted by Bill Barker <wb...@wilshire.com>.
----- Original Message -----
From: "Tim Funk" <fu...@joedog.org>
To: "Tomcat Developers List" <to...@jakarta.apache.org>
Sent: Friday, July 25, 2003 3:59 AM
Subject: [5] welcome files not compliant?


> The default tomcat install has a welcome file list of:
> index.html
> index.htm
> index.jsp
>
> On a HEAD build with no changes to ROOT webapp - all is OK. But if I
create a
> file index.html, then index.jsp still gets served.
>
> On a (very)quick glance of the mapper, I see rule 4 and 6:
> // Rule 4 -- Welcome resources processing for servlets
> // Rule 6 -- Welcome resources processing for physical folder
>
> This leads me to believe that servlets get served as welcome files before
> physical files can be served which doesn't follow the order constaint.

I've been meaning to get around to that one.  Yes, it's broken.

>
> As a bonus question: Do we still need any welcome file processing anymore
in
> default servlet since the decoding is done in the mapper? Or can the
default
> servlet immediately return the directory listing (or forbidden) on
directory
> match?

Probably not.  And since the way DefaultServlet handles welcome-files is now
forbidden in the spec we might as well get rid of the processing.

>
> -Tim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>