public URL getResource()

in src/main/java/org/apache/sling/launchpad/base/webapp/SlingServletDelegate.java [543:585]


        public URL getResource(String path) {
            // nothing for empty or null path
            if (path == null || path.length() == 0) {
                return null;
            }

            // ensure leading slash
            if (path.charAt(0) != '/') {
                path = "/" + path;
            }

            try {
                // try direct path
                URL resource = servletContext.getResource(path);
                if (resource != null) {
                    return resource;
                }

                // otherwise try WEB-INF location
                resource = servletContext.getResource(WEB_INF + path);
                if(resource != null) {
                    return resource;
                }

                // try classpath
                resource = super.getResource(path);
                if(resource != null) {
                    return resource;
                }

                // try WEB-INF within the classpath
                resource = super.getResource(WEB_INF + path);
                if(resource != null) {
                    return resource;
                }

            } catch (MalformedURLException mue) {
                servletContext.log("Failure to get resource " + path, mue);
            }

            // fall back to no resource found
            return null;
        }