URL Pattern Syntax
URL patterns use an extremely simple syntax. Every character in a pattern must match the corresponding character in the URL path exactly, with two exceptions. At the end of a pattern, /* matches any sequence of characters from that point forward. The pattern *.extension matches any file name ending with extension. No other wildcards are supported, and an asterisk at any other position in the pattern is not a wildcard.
For example, a web.xml file for the examples context on the servlet container at example.com matches the pattern in <url-pattern>/status/*</url-pattern> as follows:
http://example.com/examples/status/synopsis
Matches
http://example.com/examples/status/complete?date=today
Matches
http://example.com/examples/status
Matches
http://example.com/examples/server/status
Does not match
A context located at the path <installdir>/apps/servlets/examples on the Agent at example.com matches the pattern in <url-pattern>*.map</url-pattern> as follows:
http://example.com/examples/US/Oregon
/Portland.map
Matches
http://example.com/examples/US/Washington
/Seattle.map
Matches
http://example.com/examples/Paris.France.map
Matches
http://example.com/examples/US/Oregon
/Portland.MAP
Does not match: the extension is uppercase
http://example.com/examples/interface
/description/mail.mapi
Does not match: the extension is mapi rather than map
Servlets and filters behave differently if a context defines two or more of them with the same URL mapping. If two servlets have the same URL mapping, it is undetermined which servlet a request will be dispatched to. If two filters have the same URL mapping, both filters will process the request. See the sections on mapping servlets (Mapping Servlets to URLs) and filters (Mapping Filters to URLs) for more complete explanations, and examples.
Although two servlets may not have identical URL mappings, they may use overlapping mappings. In this case, the matching procedure determines which servlet the container calls.