Iterator<Route> matches = Iterators.filter(routes.iterator(), canHandle(type, method));
if (matches.hasNext()) {
try {
return matches.next().urlFor(type, method, params);
} catch (Exception e) {
throw new VRaptorException("The selected route is invalid for redirection: " + type.getName() + "."
+ method.getName(), e);
}
}
throw new RouteNotFoundException("The selected route is invalid for redirection: " + type.getName() + "."
+ method.getName());