Package io.grpc.xds

Class RoutingUtils


  • final class RoutingUtils
    extends java.lang.Object
    Utilities for performing virtual host domain name matching and route matching.
    • Constructor Detail

      • RoutingUtils

        private RoutingUtils()
    • Method Detail

      • findVirtualHostForHostName

        @Nullable
        static VirtualHost findVirtualHostForHostName​(java.util.List<VirtualHost> virtualHosts,
                                                      java.lang.String hostName)
        Returns the VirtualHost with the best match domain for the given hostname.
      • matchHostName

        private static boolean matchHostName​(java.lang.String hostName,
                                             java.lang.String pattern)
        Returns true iff hostName matches the domain name pattern with case-insensitive.

        Wildcard pattern rules:

        1. A single asterisk (*) matches any domain.
        2. Asterisk (*) is only permitted in the left-most or the right-most part of the pattern, but not both.
      • getHeaderValue

        @Nullable
        private static java.lang.String getHeaderValue​(io.grpc.Metadata headers,
                                                       java.lang.String headerName)