| Servlet containers must use URL paths to map requests to servlets. The container uses the RequestURI from the request, minus the context path, as the path to map to a servlet. The URL path mapping rules are as follows (where the first match wins and no further rules are attempted): -
The servlet container will try to match the exact path of the request to a servlet. -
The container will then try to recursively match the longest path prefix mapping. This process occurs by stepping down the path tree a directory at a time, using the '/' character as a path separator, and determining if there is a match with a servlet. -
If the last node of the url-path contains an extension ( .jsp for example), the servlet container will try to match a servlet that handles requests for the extension. An extension is defined as the part of the path after the last '.' character. -
If neither of the previous two rules results 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 in this case. |