Set application classloader on the Rhino context to our app classloader.

This commit is contained in:
hns 2003-12-01 13:28:20 +00:00
parent 275d882f92
commit 0c9ecfd10d
2 changed files with 3 additions and 0 deletions

View file

@ -69,6 +69,7 @@ public final class RhinoCore {
Context context = Context.enter(); Context context = Context.enter();
context.setCompileFunctionsWithDynamicScope(true); context.setCompileFunctionsWithDynamicScope(true);
context.setApplicationClassLoader(app.getClassLoader());
wrapper = new WrapMaker(); wrapper = new WrapMaker();
wrapper.setJavaPrimitiveWrap(false); wrapper.setJavaPrimitiveWrap(false);
context.setWrapFactory(wrapper); context.setWrapFactory(wrapper);

View file

@ -79,6 +79,7 @@ public class RhinoEngine implements ScriptingEngine {
core = getRhinoCore(app); core = getRhinoCore(app);
context = Context.enter(); context = Context.enter();
context.setCompileFunctionsWithDynamicScope(true); context.setCompileFunctionsWithDynamicScope(true);
context.setApplicationClassLoader(app.getClassLoader());
try { try {
global = new GlobalObject(core, app); // context.newObject(core.global); global = new GlobalObject(core, app); // context.newObject(core.global);
@ -144,6 +145,7 @@ public class RhinoEngine implements ScriptingEngine {
public void updatePrototypes() { public void updatePrototypes() {
context = Context.enter(); context = Context.enter();
context.setCompileFunctionsWithDynamicScope(true); context.setCompileFunctionsWithDynamicScope(true);
context.setApplicationClassLoader(app.getClassLoader());
context.setWrapFactory(core.wrapper); context.setWrapFactory(core.wrapper);
boolean trace = "true".equals(app.getProperty("rhino.trace")); boolean trace = "true".equals(app.getProperty("rhino.trace"));