2007-03-02 17:32:25 UTC
According to Servlet Specification 2.4 order of mappings should not matter - the most specific mapping shall be used. It, definitely, does not preclude specific servlet container to be buggy, but ... I just have tested - with Tomcat 5.5.20 it really does not matter, if I swap mappings, application behavior is not affected.
Here is quotation from Servlet Specification 2.4 (chapter 11.1)
-----------------------------------------------------------------
1. The container will try to find an exact match of the path of the request to the
path of the servlet. A successful match selects the servlet.
2. The container will recursively try to match the longest path-prefix. This is done
by stepping down the path tree a directory at a time, using the ’/’ character as
a path separator. The longest match determines the servlet selected.
1. Previous versions of this specification made use of these mapping techniques
as a suggestion rather than a requirement, allowing servlet containers
to each have their different schemes for mapping client requests
to servlets.
MAPPING REQUESTS TO SERVLETS
Final Version
86
3. If the last segment in the URL path contains an extension (e.g. .jsp), the servlet
container will try to match a servlet that handles requests for the extension.
An extension is defined as the part of the last segment after the last ’.’ character.
4. If neither of the previous three rules result in a servlet match, the container will
attempt to serve content appropriate for the resource requested. If a "default"
servlet is defined for the application, it will be used.
-----------------------------------------------------------------
Regards,
Oleksandr