use of org.webpieces.router.impl.model.MatchResult2 in project webpieces by deanhiller.
the class AbstractRouterImpl method matches.
@Override
public MatchResult2 matches(RouterRequest request, String subPath) {
Matcher matcher = matchesAndParseParams(request, subPath);
if (matcher == null)
return new MatchResult2(false);
else if (!matcher.matches())
return new MatchResult2(false);
Map<String, String> namesToValues = new HashMap<>();
for (String name : matchInfo.getPathParamNames()) {
String value = matcher.group(name);
if (value == null)
throw new IllegalArgumentException("Bug, something went wrong. request=" + request);
// convert special characters back to their normal form like '+' to ' ' (space)
String decodedVal = urlDecode(value);
namesToValues.put(name, decodedVal);
}
return new MatchResult2(namesToValues);
}
Aggregations