// (c) and (d) Filter E: remove members do not match U or final
// match not empty
for (ResourceMethodOrLocator methodOrLocator : resClass
.getResourceMethodsAndLocators()) {
PathRegExp pathRegExp = methodOrLocator.getPathRegExp();
MatchingResult matchingResult = pathRegExp.match(u);
if (matchingResult == null)
continue;
if (matchingResult.getFinalCapturingGroup().isEmptyOrSlash())
eWithMethod.add(methodOrLocator);
// the following is added by Stephan (is not in spec 2008-03-06)
else if (methodOrLocator instanceof SubResourceLocator)
eWithMethod.add(methodOrLocator);
}
// (e) If E is empty -> HTTP 404
if (eWithMethod.isEmpty())
excHandler.resourceNotFound();// NICE (o.getClass(), u);
// (f) and (g) sort E, use first member of E
ResourceMethodOrLocator firstMeth = getFirstByNoOfLiteralCharsNoOfCapturingGroups(eWithMethod);
PathRegExp rMatch = firstMeth.getPathRegExp();
MatchingResult matchingResult = rMatch.match(u);
addPathVarsToMap(matchingResult, callContext);
// (h) When Method is resource method
if (firstMeth instanceof ResourceMethod)
return new ResObjAndRemPath(o, u);
String matchedUriPart = matchingResult.getMatched();
Object jaxRsResObj = o.getJaxRsResourceObject();
callContext.addForMatched(jaxRsResObj, matchedUriPart);
// (g) and (i)
u = matchingResult.getFinalCapturingGroup();
SubResourceLocator subResourceLocator = (SubResourceLocator) firstMeth;
o = createSubResource(o, subResourceLocator, callContext);
resClass = o.getResourceClass();
// (j) Go to step 2a (repeat for)
}