Class RoutingUtils
java.lang.Object
io.grpc.xds.RoutingUtils
Utilities for performing virtual host domain name matching and route matching.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static VirtualHostfindVirtualHostForHostName(List<VirtualHost> virtualHosts, String hostName) Returns theVirtualHostwith the best match domain for the given hostname.private static StringgetHeaderValue(io.grpc.Metadata headers, String headerName) private static booleanmatchHostName(String hostName, String pattern) ReturnstrueiffhostNamematches the domain namepatternwith case-insensitive.private static booleanmatchPath(VirtualHost.Route.RouteMatch.PathMatcher pathMatcher, String fullMethodName) (package private) static booleanmatchRoute(VirtualHost.Route.RouteMatch routeMatch, String fullMethodName, io.grpc.Metadata headers, ThreadSafeRandom random) Returnstrueiff the givenVirtualHost.Route.RouteMatchmatches the RPC's full method name and headers.
-
Constructor Details
-
RoutingUtils
private RoutingUtils()
-
-
Method Details
-
findVirtualHostForHostName
@Nullable static VirtualHost findVirtualHostForHostName(List<VirtualHost> virtualHosts, String hostName) Returns theVirtualHostwith the best match domain for the given hostname. -
matchHostName
ReturnstrueiffhostNamematches the domain namepatternwith case-insensitive.Wildcard pattern rules:
- A single asterisk (*) matches any domain.
- Asterisk (*) is only permitted in the left-most or the right-most part of the pattern, but not both.
-
matchRoute
static boolean matchRoute(VirtualHost.Route.RouteMatch routeMatch, String fullMethodName, io.grpc.Metadata headers, ThreadSafeRandom random) Returnstrueiff the givenVirtualHost.Route.RouteMatchmatches the RPC's full method name and headers. -
matchPath
private static boolean matchPath(VirtualHost.Route.RouteMatch.PathMatcher pathMatcher, String fullMethodName) -
getHeaderValue
-