Mappers
A container uses the mapping rules defined by the servlet specification to map an incoming request URI to the appropriate context and servlet that will process the request.
In this section, we will explore these rules and then discover how this mapping is implemented within Tomcat.
Mapping rules
The target context is determined based on the longest context path on the URL that matches one of the contexts for the specified virtual host.
Once a successful context match has been found, the remainder of the URL, up to the query string, is considered for a match with the wrappers associated with that context. Each of the rules below is tried, in a case sensitive manner, until the first match is found, at which point the matched wrapper is returned.
Exact path matching: The servlet path on the request is checked for an exact match with the servlet path in the
<servlet-mapping>
element. An exact match pattern must start with a/
and must not end with a/*
. An example of an exact...