code: public boolean isDirectoryURL(URL url) {
          try {
              return url.getProtocol().equals("file") && new File(url.toURI()).isDirectory();
          } catch (URISyntaxException e) {
              logger.error("Could not URL convert to URI", e);
          }
          return false;
      }
docs: Check the URL is a directory.
  With war style deployment, AssetsController exposes the file list of assets directories.
  For example, a request to http://localhost:8080/assets/css/ displays the file list of css directory.
  So this method checks the URL is a directory.
  
  @param url A URL of assets
  @return true if the URL is a directory