MCPcopy Create free account
hub / github.com/grpc/grpc-java / matchPath

Method matchPath

xds/src/main/java/io/grpc/xds/RoutingUtils.java:160–172  ·  view source on GitHub ↗
(PathMatcher pathMatcher, String fullMethodName)

Source from the content-addressed store, hash-verified

158 }
159
160 private static boolean matchPath(PathMatcher pathMatcher, String fullMethodName) {
161 if (pathMatcher.path() != null) {
162 return pathMatcher.caseSensitive()
163 ? pathMatcher.path().equals(fullMethodName)
164 : pathMatcher.path().equalsIgnoreCase(fullMethodName);
165 } else if (pathMatcher.prefix() != null) {
166 return pathMatcher.caseSensitive()
167 ? fullMethodName.startsWith(pathMatcher.prefix())
168 : fullMethodName.toLowerCase(Locale.US).startsWith(
169 pathMatcher.prefix().toLowerCase(Locale.US));
170 }
171 return pathMatcher.regEx().matches(fullMethodName);
172 }
173
174 @Nullable
175 private static String getHeaderValue(Metadata headers, String headerName) {

Callers 1

matchRouteMethod · 0.95

Calls 6

caseSensitiveMethod · 0.80
matchesMethod · 0.65
pathMethod · 0.45
equalsMethod · 0.45
prefixMethod · 0.45
regExMethod · 0.45

Tested by

no test coverage detected