List<SubResourceInstance> list = new LinkedList<SubResourceInstance>();
// add records according to the request uri
for (SubResourceRecord record : subResources) {
UriTemplateMatcher matcher = record.getTemplateProcessor().matcher();
// if the uri is a match to the uri template
if (matcher.matches(uri)) {
if (method && record instanceof SubResourceMethodRecord && matcher.isExactMatch()) {
list.add(new SubResourceInstance(record, matcher));
}
if (locator && record instanceof SubResourceLocatorRecord) {
list.add(new SubResourceInstance(record, matcher));