Note: The following urls do not contain ContextPath.
Servlet ing URL specification
1. Indicates path ing starting with/and ending with/*, that is,/Test/* indicates that the request path starts with/Test/is mapped to the Servlet for processing.
2. Extension ing starting with *. That is, *. abc indicates that all requests with abc extension are mapped to the Servlet for processing.
3. Start with/to indicate full ing, that is,/Test indicates that the request URL is/Test mapped to the Servlet for processing.
4. If the URL Pattern is/, it is mapped to the default Servlet. When other URL mappings do not match, the default Servlet is used.
Path Matching Sequence
1. First match the fully mapped URL
2. re-match the URL mapped to the path, and the longest path is matched first.
3. re-match the extension ing
4. Use the default Servlet.
The following is an example
Servlet ing
Path pattern servlet
/Foo/bar/* servlet1
/Baz/* servlet2
/Catalog servlet3
*. Bop servlet4
Incoming path servlet handling request
/Foo/bar/index.html servlet1
/Foo/bar/index. bop servlet1
/Baz servlet2
/Baz/index.html servlet2
/Catalog servlet3
/Catalog/index.html "default" servlet
/Catalog/racecar. bop servlet4
/Index. bop servlet4
ServletPath and PathInfo in various matching Modes
1. fully match ServletPath = matching pattern PathInfo = null
2. The extension matches ServletPath = the requested URL PathInfo = null.
3. Path match ServletPath = match mode cut "/*" PathInfo = request URL cut ServletPath
4. By default, Servlet matches ServletPath = requested URL PathInfo = null
If the same URL is mapped to multiple Servlets, The Serlvet specification is not described. tomcat (a very useful JSP running platform) uses the last mapped Servlet.
If the Servlet ing in the container is overwritten, use the new ing.