ScriptingEngine.invoke() is now called with the wrapping Beans as arguments, so

ScriptingEngine implementations do not have to create the beans themselves anymore.
This commit is contained in:
hns 2002-10-14 15:13:02 +00:00
parent 1fbe23bc03
commit 43b9e08027
2 changed files with 13 additions and 12 deletions

View file

@ -70,6 +70,7 @@ public final class RequestEvaluator implements Runnable {
protected void initScriptingEngine () { protected void initScriptingEngine () {
if (scriptingEngine == null) if (scriptingEngine == null)
scriptingEngine = helma.scripting.fesi.FesiEngineFactory.getEngine (app, this); scriptingEngine = helma.scripting.fesi.FesiEngineFactory.getEngine (app, this);
// scriptingEngine = helma.scripting.rhino.RhinoEngineFactory.getEngine (app, this);
} }
public void run () { public void run () {
@ -118,11 +119,11 @@ public final class RequestEvaluator implements Runnable {
HashMap globals = new HashMap (); HashMap globals = new HashMap ();
globals.put ("root", root); globals.put ("root", root);
globals.put ("session", session); globals.put ("session", new SessionBean (session));
globals.put ("req", req); globals.put ("req", new RequestBean (req));
globals.put ("res", res); globals.put ("res", new ResponseBean (res));
globals.put ("app", new ApplicationBean (app));
globals.put ("path", requestPath); globals.put ("path", requestPath);
globals.put ("app", app);
req.startTime = System.currentTimeMillis (); req.startTime = System.currentTimeMillis ();
if (error != null) if (error != null)
res.error = error; res.error = error;
@ -334,8 +335,8 @@ public final class RequestEvaluator implements Runnable {
HashMap globals = new HashMap (); HashMap globals = new HashMap ();
globals.put ("root", root); globals.put ("root", root);
globals.put ("res", res); globals.put ("res", new ResponseBean (res));
globals.put ("app", app); globals.put ("app", new ApplicationBean (app));
scriptingEngine.enterContext (globals); scriptingEngine.enterContext (globals);
@ -405,8 +406,8 @@ public final class RequestEvaluator implements Runnable {
HashMap globals = new HashMap (); HashMap globals = new HashMap ();
globals.put ("root", root); globals.put ("root", root);
globals.put ("res", res); globals.put ("res", new ResponseBean (res));
globals.put ("app", app); globals.put ("app", new ApplicationBean (app));
scriptingEngine.enterContext (globals); scriptingEngine.enterContext (globals);
// reset skin recursion detection counter // reset skin recursion detection counter

View file

@ -334,13 +334,13 @@ public final class FesiEvaluator implements ScriptingEngine {
} }
sv = parr; sv = parr;
} else if ("req".equals (k)) { } else if ("req".equals (k)) {
sv = new ESBeanWrapper (new RequestBean ((RequestTrans) v), this); sv = new ESBeanWrapper (v, this);
} else if ("res".equals (k)) { } else if ("res".equals (k)) {
sv = new ESBeanWrapper (new ResponseBean ((ResponseTrans) v), this); sv = new ESBeanWrapper (v, this);
} else if ("session".equals (k)) { } else if ("session".equals (k)) {
sv = new ESBeanWrapper (new SessionBean ((Session)v), this); sv = new ESBeanWrapper (v, this);
} else if ("app".equals (k)) { } else if ("app".equals (k)) {
sv = new ESBeanWrapper (new ApplicationBean ((Application)v), this); sv = new ESBeanWrapper (v, this);
} else if (v instanceof ESValue) { } else if (v instanceof ESValue) {
sv = (ESValue)v; sv = (ESValue)v;
} else { } else {