code: public static String getRoot(String url) {
          if (StringUtils.isBlank(url)) {
              return null;
          }
          return RegExUtils.replacePattern(url, "(.*?://.*?)([/?#].*)", "$1");
      }
docs: <p>Gets the root of a URL. That is the left part of a URL up to and
  including the host name. A <code>null</code> or empty string returns
  a <code>null</code> document root.
  This method is a short form of:<br>
  <code>new HttpURL("http://example.com/path").getRoot();</code>
  </p>
  @param url a URL string
  @return left part of a URL up to (and including the host name
  @since 1.8.0