@Override
    public boolean exists() {
        // Try file existence: can we find the file in the file system?
        try {
            return getFile().exists();
        } catch (IOException ex) {
            // Fall back to stream existence: can we open the stream?
            try {
                InputStream is = getInputStream();
                is.close();
                return true;
            } catch (Throwable isEx) {
                return false;
            }
        }
    }
This implementation checks whether a File can be opened,
falling back to whether an InputStream can be opened.
This will cover both directories and content resources.
src/main/java/spark/resource/AbstractResource.java