This method is used to check the validity of url pattern
according to the spec. It is used in the following places:
1. in WebResourceCollection
2. in ServletMapping
3. in ServletFilterMapping
(above three see Servlet Spec, from version 2.3 on,
Secion 13.2: "Rules for Processing the Deployment Descriptor")
4. in jsp-property-group
(see JSP.3.3: "JSP Property Groups")
// URL Pattern should not contain New Line (NL) or
// Carriage Return (CR)
if (urlPattern.indexOf(NL) != -1 || urlPattern.indexOf (CR) != -1) {
return false;
}
// Check validity for extension mapping
if (urlPattern.startsWith("*.")) {
if (urlPattern.indexOf('/") < 0) {
return true;
} else {
return false;
}
}
// check validity for path mapping
if ( urlPattern.startsWith("/") && urlPattern.indexOf("*.") < 0) {
return true;
} else {
return false;
}