RequestContext context = (RequestContext) request;
String uri = context.getTargetPath();
for (Pattern pattern : patterns.keySet()) {
Matcher matcher = pattern.matcher(uri);
if (matcher.matches()) {
TargetType type = patterns.get(pattern);
return getTarget(type, context, matcher);
}
}
return null;
}