From 084b0e8e6c61e377eb012b54fe78e75fe50534d7 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 26 Jun 2003 16:52:05 +0000 Subject: [PATCH] Implement phantom engine classloader trick for rhino --- .../main/launcher/FilteredClassLoader.java | 3 +- src/helma/scripting/rhino/PhantomEngine.java | 32 +++++++++++++++++++ src/helma/scripting/rhino/RhinoEngine.java | 2 +- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 src/helma/scripting/rhino/PhantomEngine.java diff --git a/src/helma/main/launcher/FilteredClassLoader.java b/src/helma/main/launcher/FilteredClassLoader.java index 4e2ceef4..1f31af9a 100644 --- a/src/helma/main/launcher/FilteredClassLoader.java +++ b/src/helma/main/launcher/FilteredClassLoader.java @@ -42,7 +42,8 @@ public class FilteredClassLoader extends URLClassLoader { * Mask classes that implement the scripting engine(s) contained in helma.jar */ protected Class findClass(String name) throws ClassNotFoundException { - if ((name != null) && "helma.scripting.fesi.PhantomEngine".equals(name)) { + if ((name != null) && (name.startsWith("helma")) && + (name.endsWith("PhantomEngine"))) { throw new ClassNotFoundException(name); } diff --git a/src/helma/scripting/rhino/PhantomEngine.java b/src/helma/scripting/rhino/PhantomEngine.java new file mode 100644 index 00000000..aaff5bbc --- /dev/null +++ b/src/helma/scripting/rhino/PhantomEngine.java @@ -0,0 +1,32 @@ +/* + * Helma License Notice + * + * The contents of this file are subject to the Helma License + * Version 2.0 (the "License"). You may not use this file except in + * compliance with the License. A copy of the License is available at + * http://adele.helma.org/download/helma/license.txt + * + * Copyright 1998-2003 Helma Software. All Rights Reserved. + * + * $RCSfile$ + * $Author$ + * $Revision$ + * $Date$ + */ + +package helma.scripting.rhino; + +import helma.scripting.ScriptingException; + +/** + * + */ +public final class PhantomEngine extends RhinoEngine { + /** + * + */ + public Object invoke(Object thisObject, String functionName, Object[] args, + boolean xmlrpc) throws ScriptingException { + return super.invoke(thisObject, functionName, args, xmlrpc); + } +} diff --git a/src/helma/scripting/rhino/RhinoEngine.java b/src/helma/scripting/rhino/RhinoEngine.java index 796956d1..727a7556 100644 --- a/src/helma/scripting/rhino/RhinoEngine.java +++ b/src/helma/scripting/rhino/RhinoEngine.java @@ -35,7 +35,7 @@ import java.util.*; /** * This is the implementation of ScriptingEnvironment for the Mozilla Rhino EcmaScript interpreter. */ -public final class RhinoEngine implements ScriptingEngine { +public class RhinoEngine implements ScriptingEngine { // map for Application to RhinoCore binding static Map coreMap;