code: public static String getHost(String resourcePath) {
          String hostSpec;
          if (resourcePath.contains(":")) {
              hostSpec = resourcePath.split(":")[0];
          } else {
              hostSpec = resourcePath;
          }
  
          if (hostSpec.contains("/")) {
              hostSpec = hostSpec.substring(0, hostSpec.indexOf('/'));
          }
  
          return hostSpec;
      }
docs: Extract host name from resource path.
  @param resourcePath
  @return