in governance/src/main/java/org/apache/servicecomb/router/model/HeaderRule.java [40:65]
public boolean match(String str) {
if (str == null) {
return false;
}
if (exact == null && regex == null) {
throw new RouterIllegalParamException(
"route management regex and exact can not br null at same time.");
}
if (caseInsensitive) {
str = str.toLowerCase();
exact = exact == null ? null : exact.toLowerCase();
regex = regex == null ? null : regex.toLowerCase();
}
if (exact != null && !str.equals(exact)) {
return false;
}
try {
if (regex != null && !str.matches(regex)) {
return false;
}
} catch (Exception e) {
LOGGER.error("route management wrong regular expression format: {}", regex);
return false;
}
return true;
}