Github user GodIsDevil commented on the issue:

    https://github.com/apache/tomcat/pull/109
  
    In the old version of Tomcat (7.0, 8.0), you used URLConnection to read all 
files or directories. I do not quite understand why the high version of Tomcat 
can not read the directory through URLConnection (FileInputStream can only read 
the file can not read the directory).
    `@Override
        public InputStream getResourceAsStream(String name) {
    
            if (log.isDebugEnabled())
                log.debug("getResourceAsStream(" + name + ")");
    
            checkStateForResourceLoading(name);
    
            InputStream stream = null;
    
            // (0) Check for a cached copy of this resource
            stream = findLoadedResource(name);
            if (stream != null) {
                if (log.isDebugEnabled())
                    log.debug("  --> Returning stream from cache");
                return (stream);
            }
    
            boolean delegateFirst = delegate || filter(name, false);
    
            // (1) Delegate to parent if requested
            if (delegateFirst) {
                if (log.isDebugEnabled())
                    log.debug("  Delegating to parent classloader " + parent);
                stream = parent.getResourceAsStream(name);
                if (stream != null) {
                    // FIXME - cache???
                    if (log.isDebugEnabled())
                        log.debug("  --> Returning stream from parent");
                    return (stream);
                }
            }
    
            // (2) Search local repositories
            if (log.isDebugEnabled())
                log.debug("  Searching local repositories");
            URL url = findResource(name);
            if (url != null) {
                // FIXME - cache???
                if (log.isDebugEnabled())
                    log.debug("  --> Returning stream from local");
                stream = findLoadedResource(name);
                try {
                    if (hasExternalRepositories && (stream == null))
                        stream = url.openStream();
                } catch (IOException e) {
                    // Ignore
                }
                if (stream != null)
                    return (stream);
            }
    
            // (3) Delegate to parent unconditionally
            if (!delegateFirst) {
                if (log.isDebugEnabled())
                    log.debug("  Delegating to parent classloader 
unconditionally " + parent);
                stream = parent.getResourceAsStream(name);
                if (stream != null) {
                    // FIXME - cache???
                    if (log.isDebugEnabled())
                        log.debug("  --> Returning stream from parent");
                    return (stream);
                }
            }
    
            // (4) Resource was not found
            if (log.isDebugEnabled())
                log.debug("  --> Resource not found, returning null");
            return (null);
    
        }
    `


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to