Author: erwan
Date: Wed Jun 23 13:08:00 2010
New Revision: 957182
URL:
http://svn.apache.org/viewvc?rev=957182&view=revLog:
Using a LocalDispatcher when having a groovy service
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java?rev=957182&r1=957181&r2=957182&view=diff==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java Wed Jun 23 13:08:00 2010
@@ -29,6 +29,7 @@ import org.codehaus.groovy.runtime.Invok
import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.GroovyUtil;
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.ServiceDispatcher;
@@ -68,8 +69,10 @@ public final class GroovyEngine extends
Map<String, Object> params = FastMap.newInstance();
params.putAll(context);
context.put("parameters", params);
- context.put("dctx", dispatcher.getLocalContext(localName));
- context.put("dispatcher", dispatcher);
+
+ DispatchContext dctx = dispatcher.getLocalContext(localName);
+ context.put("dctx", dctx);
+ context.put("dispatcher", dctx.getDispatcher());
context.put("delegator", dispatcher.getDelegator());
try {
Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)), GroovyUtil.getBinding(context));