You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2007/09/17 17:36:14 UTC

DO NOT REPLY [Bug 43409] New: - Error location wrongly despatched to servlet

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409

           Summary: Error location wrongly despatched to servlet
           Product: Tomcat 5
           Version: 5.5.23
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: werner.donne@re.be


When there is a servlet with mapping "/*", as well as error pages with an error
location pointing to an HTML file, the error locations are despatched to the
servlet. This is not correct, because when the error location doesn't refer to a
servlet or JSP it denotes a path in the WAR file. The fact that this path also
happens to match the pattern of a servlet is not relevant.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From markt@apache.org  2007-11-23 11:23 -------
(In reply to comment #6)
> For any request, when there is a perfect match with a static resource in the web
> application SRV.11 does not apply. You just return the resource.

I can not find any such statement in the Servlet spec. Please provide the
relevant  section or quote from the spec if you re-open this bug.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409





------- Additional Comments From werner.donne@re.be  2007-11-23 13:31 -------
Of course there is no such literal statement. You just have to combine two things:

1. A web application may have several kinds of resources.
2. The best match is served.

You are suggesting that there can be a situation where a less than perfect match
(a servlet in this case) is preferred over a perfect match (a static resource in
this case). What is the logic behind that?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409


werner.donne@re.be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Additional Comments From werner.donne@re.be  2007-10-01 00:17 -------
It is not true that resources are always provided by servlets. According to
SRV.9.13 a web application doesn't even have to contain a servlet. You are
confusing the "default" servlet, as defined in the spec, with
org.apache.catalina.servlets.DefaultServlet, which is nothing more than an
implementation element.

For any request, when there is a perfect match with a static resource in the web
application SRV.11 does not apply. You just return the resource. It is possible
that the implementation of the container uses its internal servlet gear to do
that, but that is not relevant.

This is a bug and the only place to discuss it is here.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409


werner.donne@re.be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Additional Comments From werner.donne@re.be  2007-09-28 00:19 -------
Indeed, it doesn't have to be a path in a WAR, but that is not the main point.
If the application contains a resource that is a perfect match for the error
location, that resource should be selected and not a servlet with the pattern
"/*", because it is less precise.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From markt@apache.org  2007-09-27 23:00 -------
Please read SRV.9.9. It refers to location as specifying a 'resource', not a
path in a WAR.

Location can't refer to a path in a WAR as as there is no requirement to deploy
apps in WARs.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From markt@apache.org  2007-09-28 23:32 -------
And now read SRV.11. I can't emphasis enough the importance of being familiar
with the spec before you start to design / implement web apps.

In your case, your error page is a static file so it does not have a mapping in
web.xml. Therefore (SRV.11.1):
- no exact match
- longest path prefix matches your /* mapping (since this overrides the default
servlet that would normally serve static resources

You need to fix your configuration. Options include:
- add explicit mappings to your static resources that map them to the DefaultServlet
- put them all in a error directory and map /error/* to the DefaultServlet

Please use the users mailing list for further help.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From markt@apache.org  2007-09-29 10:09 -------
(In reply to comment #4)
> If the error page exists as a static resource it must be returned.

The spec does not say this. It says that if the error matches one of your error
page declarations, then the corresponding resource should be returned. Resources
are always provided by servlets, even static content. The mapping of resources
to servlets is defined by SRV.11.

> The above paragraph doesn't say the resource should be dynamic.

No it doesn't, but it *can* be dynamic - hence SRV.11 applies (which also
applies to static resources which are normally served by the default servlet.

Bugzilla is not the place to have discussions like this. Please use the users list.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409





------- Additional Comments From werner.donne@re.be  2007-11-23 15:05 -------
I am not implying a static resource should always take precedence as such, but
that the best matching resource should be taken. In order for a static resource
to be selected there would have to be a perfect match, because its path is fully
specified.

It is indeed step 4 in SRV.11.1 that puts static resources behind servlets
(keeping in mind that in the case in point there is no "default" servlet in the
deployment descriptor). So I yield, but this choice still doesn't make any sense
to me. The treatment of welcome files, for example, isn't consistent with it.
There static resources are considered first.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409





------- Additional Comments From markt@apache.org  2007-11-23 14:13 -------
(In reply to comment #8)
> Of course there is no such literal statement. You just have to combine two things:
> 1. A web application may have several kinds of resources.
Agreed. Further, I think we also agree that locations specified for error
handlers can refer to any valid resource in the web app. 

> 2. The best match is served.
The spec doesn't say this. SRV.9.9 mentions JSPs and Servlets as possible
locations for error handlers and indirectly mentions static files when it refers
to resources. The only place the spec defines how to work out which resource to
use when a location could be referring to a static or a dynamic resource is
SRV.11. This is no 'if the request matches a static resource that that always
takes precedence' rule. The spec isn't always as clear cut as I would like but I
can't find anywhere that even hints at static resources taking precedence.

> You are suggesting that there can be a situation where a less than perfect match
> (a servlet in this case) is preferred over a perfect match (a static resource in
> this case). What is the logic behind that?

This is exactly what can, and frequently does, happen as a result of applying
the rules in SRV.11


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 43409] - Error location wrongly despatched to servlet

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43409>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43409


werner.donne@re.be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Additional Comments From werner.donne@re.be  2007-09-29 02:20 -------
Of course a static file has no mapping in the deployment descriptor, but it is
part of the web application. It is a web resource. SRV.9.9.2 says:

"If the sendError method is called on the response, the container consults the
list of error page declarations for the Web application that use the status-code
syntax and attempts a match. If there is a match, the container returns the
resource as indicated by the location entry."

If the error page exists as a static resource it must be returned. The above
paragraph doesn't say the resource should be dynamic.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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