if (requestPathInfo == null) {
// might be extension mapping
for (int i = 0, size = mappings.size(); i < size; i++) {
ServletMapping servletMapping = (ServletMapping) mappings.get(i);
String urlpattern = servletMapping.getUrlPattern();
String extension = urlpattern.substring(1, urlpattern.length());
if (servletPath.endsWith(extension)) {
return servletMapping;
}
else if (servletPath.equals(urlpattern)) {
// path mapping with no pathInfo for the current request
return servletMapping;
}
}
}
else {
// path mapping
for (int i = 0, size = mappings.size(); i < size; i++) {
ServletMapping servletMapping = (ServletMapping) mappings.get(i);
String urlpattern = servletMapping.getUrlPattern();
urlpattern = urlpattern.substring(0, urlpattern.length() - 2);
// servletPath starts with "/" except in the case where the
// request is matched with the "/*" pattern, in which case
// it is the empty string (see Servlet Sepc 2.3 SRV4.4)
if (servletPath.equals(urlpattern)) {