if (logger.isTraceEnabled()) {
logger.trace("pattern [" + pattern + "]");
logger.trace("host [" + host + "]");
}
Matcher m = new Pattern(pattern).matcher(host);
this.hostPattern = new Pattern(pattern);
if (m.matches()) {
if (this.host.contains("{")) {
String name = m.group(1).replace("{", "").replace("}", "");
hostArg = new Arg();
hostArg.name = name;
if (logger.isTraceEnabled()) {
logger.trace("hostArg name [" + name + "]");
}
// The default value contains the route version of the host ie {client}.bla.com
// It is temporary and it indicates it is an url route.
// TODO Check that default value is actually used for other cases.
hostArg.defaultValue = host;
hostArg.constraint = new Pattern(".*");
if (logger.isTraceEnabled()) {
logger.trace("adding hostArg [" + hostArg + "]");
}
args.add(hostArg);
}
}
}
String patternString = path;
patternString = customRegexPattern.replacer("\\{<[^/]+>$1\\}").replace(patternString);
Matcher matcher = argsPattern.matcher(patternString);
while (matcher.find()) {
Arg arg = new Arg();
arg.name = matcher.group(2);
arg.constraint = new Pattern(matcher.group(1));
args.add(arg);
}
patternString = argsPattern.replacer("({$2}$1)").replace(patternString);
this.pattern = new Pattern(patternString);