This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 6f7f03b742 Fixed: RequestMap.event with type service multi doesn't 
work with dynamic url (OFBIZ-12604)
6f7f03b742 is described below

commit 6f7f03b74206833ca51bc0529636f3288c71e897
Author: Nicolas Malin <nicolas.ma...@nereide.fr>
AuthorDate: Fri Apr 22 16:09:00 2022 +0200

    Fixed: RequestMap.event with type service multi doesn't work with dynamic 
url (OFBIZ-12604)
    
    When you define a controller request-map with an event of type 
'service-multi', if your uri contains multiple allocation like 'MyWay/MyAction' 
the class ServiceMultiEventHandler failed to execute with an 
EventHandlerException
    
     *****
        <request-map uri="Payment/QuickSend">
            ...
            <event type="service-multi" invoke="quickSendPayment"/>
            ...
     *****
    
    The reason comes from the necessary to resolve the attribute 
global-transaction on event definition, and to do that a call to 
ConfigXMLReader is realized.
    
    But unnecessary because we already have the event element on the context.
    Use it directly, simplify the code and fix this issue
---
 .../apache/ofbiz/webapp/event/ServiceMultiEventHandler.java   | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java
 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java
index d05de39f94..439c3631c2 100644
--- 
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java
+++ 
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java
@@ -158,16 +158,7 @@ public class ServiceMultiEventHandler implements 
EventHandler {
         List<Object> errorMessages = new LinkedList<>();
         List<String> successMessages = new LinkedList<>();
 
-        // Check the global-transaction attribute of the event from the 
controller to see if the
-        //  event should be wrapped in a transaction
-        String requestUri = 
RequestHandler.getRequestUri(request.getPathInfo());
-        ConfigXMLReader.ControllerConfig controllerConfig;
-        try {
-            controllerConfig = 
ConfigXMLReader.getControllerConfig(ConfigXMLReader.getControllerConfigURL(servletContext));
-        } catch (WebAppConfigurationException e) {
-            throw new EventHandlerException(e);
-        }
-        boolean eventGlobalTransaction = 
controllerConfig.getRequestMapMap().get(requestUri).getEvent().isGlobalTransaction();
+        boolean eventGlobalTransaction = event.isGlobalTransaction();
 
         // big try/finally to make sure commit or rollback are run
         boolean beganTrans = false;

Reply via email to