Author: bibryam
Date: Fri Oct 24 03:35:00 2008
New Revision: 707599
URL:
http://svn.apache.org/viewvc?rev=707599&view=revLog:
A patch from Joe Eckard "Groovy & Beanshell Service Engines do not provide DispatchContext to scripts" - OFBIZ-1979
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyEngine.java
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java?rev=707599&r1=707598&r2=707599&view=diff==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java Fri Oct 24 03:35:00 2008
@@ -18,27 +18,19 @@
*******************************************************************************/
package org.ofbiz.service.engine;
-import java.net.URL;
import java.util.Map;
import org.ofbiz.base.util.BshUtil;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.base.util.HttpClient;
-import org.ofbiz.base.util.HttpClientException;
import static org.ofbiz.base.util.UtilGenerics.cast;
-import org.ofbiz.base.util.UtilURL;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.cache.UtilCache;
-import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.ServiceDispatcher;
import org.ofbiz.service.ServiceUtil;
-import bsh.EvalError;
-import bsh.Interpreter;
-
/**
* BeanShell Script Service Engine
*/
@@ -67,10 +59,11 @@
// Invoke the BeanShell Script.
private Map<String, Object> serviceInvoker(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException {
if (UtilValidate.isEmpty(modelService.location)) {
- throw new GenericServiceException("Cannot run Groovy service with empty location");
+ throw new GenericServiceException("Cannot run Beanshell service with empty location");
}
String location = this.getLocation(modelService);
+ context.put("dctx", dispatcher.getLocalContext(localName));
try {
Object resultObj = BshUtil.runBshAtLocation(location, context);
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=707599&r1=707598&r2=707599&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 Fri Oct 24 03:35:00 2008
@@ -58,6 +58,7 @@
}
String location = this.getLocation(modelService);
+ context.put("dctx", dispatcher.getLocalContext(localName));
try {
Object resultObj = GroovyUtil.runScriptAtLocation(location, context);