code: private ImmutableMap<String, String> match(String path, boolean forceHostName) {
      // Quick check for trailing custom verb.
      Segment last = segments.get(segments.size() - 1);
      if (last.kind() == SegmentKind.CUSTOM_VERB) {
        Matcher matcher = CUSTOM_VERB_PATTERN.matcher(path);
        if (!matcher.find() || !decodeUrl(matcher.group(1)).equals(last.value())) {
          return null;
        }
        path = path.substring(0, matcher.start(0));
      }
  
      // Do full match.
      boolean withHostName = path.startsWith("//");
      if (withHostName) {
        path = path.substring(2);
      }
      List<String> input = SLASH_SPLITTER.splitToList(path);
      int inPos = 0;
      Map<String, String> values = Maps.newLinkedHashMap();
      if (withHostName || forceHostName) {
        if (input.isEmpty()) {
          return null;
        }
        String hostName = input.get(inPos++);
        if (withHostName) {
          // Put the // back, so we can distinguish this case from forceHostName.
          hostName = "//" + hostName;
        }
        values.put(HOSTNAME_VAR, hostName);
      }
      if (!match(input, inPos, segments, 0, values)) {
        return null;
      }
      return ImmutableMap.copyOf(values);
    }
docs: Matches a path.