From 43b9e0802781aabec7219771bddfcabab7d0432b Mon Sep 17 00:00:00 2001 From: hns Date: Mon, 14 Oct 2002 15:13:02 +0000 Subject: [PATCH] ScriptingEngine.invoke() is now called with the wrapping Beans as arguments, so ScriptingEngine implementations do not have to create the beans themselves anymore. --- src/helma/framework/core/RequestEvaluator.java | 17 +++++++++-------- src/helma/scripting/fesi/FesiEvaluator.java | 8 ++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/helma/framework/core/RequestEvaluator.java b/src/helma/framework/core/RequestEvaluator.java index 8e1b1670..10528386 100644 --- a/src/helma/framework/core/RequestEvaluator.java +++ b/src/helma/framework/core/RequestEvaluator.java @@ -70,6 +70,7 @@ public final class RequestEvaluator implements Runnable { protected void initScriptingEngine () { if (scriptingEngine == null) scriptingEngine = helma.scripting.fesi.FesiEngineFactory.getEngine (app, this); + // scriptingEngine = helma.scripting.rhino.RhinoEngineFactory.getEngine (app, this); } public void run () { @@ -118,11 +119,11 @@ public final class RequestEvaluator implements Runnable { HashMap globals = new HashMap (); globals.put ("root", root); - globals.put ("session", session); - globals.put ("req", req); - globals.put ("res", res); + globals.put ("session", new SessionBean (session)); + globals.put ("req", new RequestBean (req)); + globals.put ("res", new ResponseBean (res)); + globals.put ("app", new ApplicationBean (app)); globals.put ("path", requestPath); - globals.put ("app", app); req.startTime = System.currentTimeMillis (); if (error != null) res.error = error; @@ -334,8 +335,8 @@ public final class RequestEvaluator implements Runnable { HashMap globals = new HashMap (); globals.put ("root", root); - globals.put ("res", res); - globals.put ("app", app); + globals.put ("res", new ResponseBean (res)); + globals.put ("app", new ApplicationBean (app)); scriptingEngine.enterContext (globals); @@ -405,8 +406,8 @@ public final class RequestEvaluator implements Runnable { HashMap globals = new HashMap (); globals.put ("root", root); - globals.put ("res", res); - globals.put ("app", app); + globals.put ("res", new ResponseBean (res)); + globals.put ("app", new ApplicationBean (app)); scriptingEngine.enterContext (globals); // reset skin recursion detection counter diff --git a/src/helma/scripting/fesi/FesiEvaluator.java b/src/helma/scripting/fesi/FesiEvaluator.java index c25e2937..8fb26dc3 100644 --- a/src/helma/scripting/fesi/FesiEvaluator.java +++ b/src/helma/scripting/fesi/FesiEvaluator.java @@ -334,13 +334,13 @@ public final class FesiEvaluator implements ScriptingEngine { } sv = parr; } else if ("req".equals (k)) { - sv = new ESBeanWrapper (new RequestBean ((RequestTrans) v), this); + sv = new ESBeanWrapper (v, this); } else if ("res".equals (k)) { - sv = new ESBeanWrapper (new ResponseBean ((ResponseTrans) v), this); + sv = new ESBeanWrapper (v, this); } else if ("session".equals (k)) { - sv = new ESBeanWrapper (new SessionBean ((Session)v), this); + sv = new ESBeanWrapper (v, this); } else if ("app".equals (k)) { - sv = new ESBeanWrapper (new ApplicationBean ((Application)v), this); + sv = new ESBeanWrapper (v, this); } else if (v instanceof ESValue) { sv = (ESValue)v; } else {