in boot/src/main/java/org/netbeans/html/boot/spi/Fn.java [530:562]
private void loadResource() throws Exception {
Ref id = super.presenter;
if (id == null) {
id = ref(FnContext.currentPresenter(false));
}
Fn.Presenter realPresenter = id == null ? null : id.presenter();
if (realPresenter != null) {
if (LOADED == null) {
LOADED = new HashMap<String, Set<Ref>>();
}
Set<Ref> there = LOADED.get(resource);
if (there == null) {
there = new HashSet<Ref>();
LOADED.put(resource, there);
}
if (there.add(id)) {
final ClassLoader l = caller.getClassLoader();
InputStream is = l.getResourceAsStream(resource);
if (is == null && resource.startsWith("/")) {
is = l.getResourceAsStream(resource.substring(1));
}
if (is == null) {
throw new IOException("Cannot find " + resource + " in " + l);
}
try {
InputStreamReader r = new InputStreamReader(is, "UTF-8");
realPresenter.loadScript(r);
} finally {
is.close();
}
}
}
}