@Override public Resource resolve(final HttpServletRequest request, final String absPath) { String path = absPath; if (path == null) { path = "/"; } // split off query string or fragment that may be appendend to the URL String urlRemainder = null; int urlRemainderPos = Math.min(path.indexOf('?'), path.indexOf('#')); if (urlRemainderPos >= 0) { urlRemainder = path.substring(urlRemainderPos); path = path.substring(0, urlRemainderPos); } // unmangle namespaces if (options.isMangleNamespacePrefixes()) { path = NamespaceMangler.unmangleNamespaces(path); } // build full path again path = path + (urlRemainder != null ? urlRemainder : ""); Resource resource = this.getResource(path); if (resource == null) { resource = new NonExistingResource(this, absPath); } return resource; }
/** * * @return the parent resource (might be a {@link NonExistingResource} in case the parent does not exist either). */ public Resource getParent() { Resource parent = super.getParent(); if (parent == null) { return new NonExistingResource(getResourceResolver(), ResourceUtil.getParent(getPath())); } else { return parent; } }
logger.debug("resolve: Path {} does not resolve, returning NonExistingResource at {}", absPath, resourcePath); res = new NonExistingResource(this, resourcePath);