MessageContext context,
HandlersChain chain) throws Throwable {
ResourceRegistry registry = context.getAttribute(ResourceRegistry.class);
SearchResult result = context.getAttribute(SearchResult.class);
ResourceInstance resource = result.getResource();
SubResourceRecord subResourceRecord = subResourceInstance.getRecord();
UriTemplateMatcher matcher = subResourceInstance.getMatcher();
String pattern = subResourceRecord.getTemplateProcessor().getPatternString();
// dispatch to one of the sub-resource methods.
SubResourceInstance method = null;
try {
// if no method is found then a RequestMatchingException exception
// is thrown