code: public static boolean isOriginForm(URI uri) {
          return uri.getScheme() == null && uri.getSchemeSpecificPart() == null &&
                 uri.getHost() == null && uri.getAuthority() == null;
      }
docs: Determine if a uri is in origin-form according to
  <a href="https://tools.ietf.org/html/rfc7230#section-5.3">rfc7230, 5.3</a>.