resource);
// If the path is not empty then do not accept
if (path.length() > 0) return false;
final HttpRequestContext request = context.getRequest();
// If an internal match resource request then always return true
if (request.getMethod().equals(WebApplicationContext.HTTP_METHOD_MATCH_RESOURCE)) {
return true;
}
if (context.isTracingEnabled()) {
final String currentPath = context.getUriInfo().getMatchedURIs().get(0);
if (isSubResource) {
final String prevPath = context.getUriInfo().getMatchedURIs().get(1);
context.trace(String.format("accept sub-resource methods: \"%s\" : \"%s\", %s -> %s",
prevPath,
currentPath.substring(prevPath.length()),
context.getRequest().getMethod(),
ReflectionHelper.objectToString(resource)));
} else {
context.trace(String.format("accept resource methods: \"%s\", %s -> %s",
currentPath,
context.getRequest().getMethod(),
ReflectionHelper.objectToString(resource)));
}
}
final HttpResponseContext response = context.getResponse();
// Get the list of resource methods for the HTTP method
ResourceMethodListPair methods = map.get(request.getMethod());
if (methods == null) {
// No resource methods are found
response.setResponse(Responses.methodNotAllowed().
header("Allow", allow).build());
// Allow any further matching rules to be processed
return false;
}
// Get the list of matching methods
List<MediaType> accept = getSpecificAcceptableMediaTypes(
request.getAcceptableMediaTypes(),
methods.priorityMediaTypes);
final Matcher m = new Matcher();
final MatchStatus s = m.match(methods, request.getMediaType(), accept);
if (s == MatchStatus.MATCH) {
// If there is a match choose the first method
final ResourceMethod method = m.rmSelected;