Override toString() in all RequestMatcher
It makes it easier to debug having custom toString(). Fixes: gh-5446
This commit is contained in:
@@ -123,6 +123,24 @@ public class MvcRequestMatcher implements RequestMatcher, RequestVariablesExtrac
|
||||
return this.servletPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Mvc [pattern='").append(this.pattern).append("'");
|
||||
|
||||
if (this.servletPath != null) {
|
||||
sb.append(", servletPath='").append(this.servletPath).append("'");
|
||||
}
|
||||
|
||||
if (this.method != null) {
|
||||
sb.append(", ").append(this.method);
|
||||
}
|
||||
|
||||
sb.append("]");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private class DefaultMatcher implements RequestMatcher, RequestVariablesExtractor {
|
||||
|
||||
private final UrlPathHelper pathHelper = new UrlPathHelper();
|
||||
|
||||
@@ -44,6 +44,11 @@ public final class AnyRequestMatcher implements RequestMatcher {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "any request";
|
||||
}
|
||||
|
||||
private AnyRequestMatcher() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +65,11 @@ public class ELRequestMatcher implements RequestMatcher {
|
||||
return new StandardEvaluationContext(new ELRequestMatcherContext(request));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("EL [el=\"").append(this.expression.getExpressionString()).append("\"");
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,4 +130,18 @@ public final class RegexRequestMatcher implements RequestMatcher {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Regex [pattern='").append(this.pattern).append("'");
|
||||
|
||||
if (this.httpMethod != null) {
|
||||
sb.append(", ").append(this.httpMethod);
|
||||
}
|
||||
|
||||
sb.append("]");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user