From servlet specification,
SRV.11.2 Specification of MappingsIn theWeb application deployment descriptor, the following syntax is used to define
mappings:
• A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used
for path mapping.
• A string beginning with a ‘*.’ prefix is used as an extension mapping.
• A string containing only the ’/’ character indicates the "default" servlet of
the application. In this case the servlet path is the request URI minus the con-
text path and the path info is null.
• All other strings are used for exact matches only.
This means Wildcard asterisk can only be used in two cases
1. at the end of a pattern, like /*
2. pattern *.extension matches any file name ending with extension
To match two urls
/r2/v1/
clientjoin and
/r2/v1/
clientleave to a filter,
r2/v1/client* won't work.
Instead, defining two url-pattern for the filter mapping solves the problem.
<
filter-mapping
>
<
filter-name
>
BasicAuthFilter
</
filter-name
>
<
url-pattern
>
/r2/v1/clientjoin
</
url-pattern
>
<
url-pattern
>
/r2/v1/clientleave
</
url-pattern
>
</
filter-mapping
>
Detailed xml schema can be found from http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd and http://java.sun.com/xml/ns/javaee/web-common_3_0.xsd