You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2022/04/22 14:15:51 UTC

[ofbiz-framework] branch release22.01 updated: Fixed: RequestMap.event with type service multi doesn't work with dynamic url (OFBIZ-12604)

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

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


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

commit 59fdc4081b543455cc9d734c173717b5a14e701a
Author: Nicolas Malin <ni...@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;