in src/main/java/org/apache/sling/maven/jspc/JspCServletContext.java [239:280]
public URL getResource(String path) throws MalformedURLException {
// catch for dummy web.xml
if (WEB_XML.equals(path)) {
return this.getClass().getResource("web.xml");
}
if (!path.startsWith("/")) {
if (path.startsWith("tld:")) {
int cs = path.indexOf(":/");
if (cs > 0 && cs < path.length()-2) {
// insert second slash after scheme (was canonicalized away)
cs += 2;
if (cs < path.length() && path.charAt(cs) != '/') {
path = path.substring(0, cs) + "/" + path.substring(cs);
}
}
try {
String[] location = tldLocationsCache.getLocation(path.substring("tld:".length()));
if (location != null && location[0].equals(path)) {
return new URL(location[1]);
}
} catch (Exception e) {}
}
throw new MalformedURLException("Path '" + path + "' does not start with '/'");
}
for (URL base: baseURLs) {
URL url = new URL(base, path.substring(1));
InputStream is = null;
try {
is = url.openStream();
// open stream succeeds, so resource exists.
return url;
} catch (Throwable t) {
// ignore
} finally {
IOUtils.closeQuietly(is);
}
}
return null;
}