code: private static String toHttp2Path(URI uri) {
          final StringBuilder pathBuilder = new StringBuilder(
                  length(uri.getRawPath()) + length(uri.getRawQuery()) + length(uri.getRawFragment()) + 2);
  
          if (!isNullOrEmpty(uri.getRawPath())) {
              pathBuilder.append(uri.getRawPath());
          }
          if (!isNullOrEmpty(uri.getRawQuery())) {
              pathBuilder.append('?');
              pathBuilder.append(uri.getRawQuery());
          }
          if (!isNullOrEmpty(uri.getRawFragment())) {
              pathBuilder.append('#');
              pathBuilder.append(uri.getRawFragment());
          }
  
          return pathBuilder.length() != 0 ? pathBuilder.toString() : EMPTY_REQUEST_PATH;
      }
docs: Generate a HTTP/2 {code :path} from a URI in accordance with
  <a href="https://tools.ietf.org/html/rfc7230#section-5.3">rfc7230, 5.3</a>.