[jira] [Commented] (AXIS2-5721) Module engaged at the service level is used globally

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (AXIS2-5721) Module engaged at the service level is used globally

Adam Fordham (Jira)

    [ https://issues.apache.org/jira/browse/AXIS2-5721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17015481#comment-17015481 ]

Jeff Thomas commented on AXIS2-5721:
------------------------------------

Here is the full implementation of the method _invoke(MessageContext)_ I went with...seems to be working.  

Switched to this approach because some handlers do not have parent Modules - for example, if they are defined directly on the phase in _axis2.xml_.

{{public final InvocationResponse invoke(MessageContext msgctx) throws AxisFault {}}

{{  if (isDebugEnabled) {}}
{{    log.debug(msgctx.getLogIDString() + " Checking pre-condition for Phase \"" + phaseName + "\"");}}
{{  }}}

{{  int currentIndex = msgctx.getCurrentPhaseIndex();}}

{{  if (currentIndex == 0) {}}
{{    checkPreconditions(msgctx);}}
{{  }}}

{{  if (isDebugEnabled) {}}
{{    log.debug(msgctx.getLogIDString() + " Invoking phase \"" + phaseName + "\"");}}
{{  }}}

{{  int handlersSize = handlers.size();}}

{{  for (int i= currentIndex; i < handlersSize; i++) {}}

{{    boolean doInvoke = true;}}

{{    Handler handler = (Handler) handlers.get(i);}}

{{    ParameterInclude handlerParent = handler.getHandlerDesc().getParent();}}

{{    if (handlerParent instanceof AxisModule) {}}

{{      AxisModule module = (AxisModule) handlerParent;}}

{{      if (!msgctx.isEngaged(module.getName())) {}}
{{        doInvoke = false;}}
{{      }}}

{{    }}}

{{    if (doInvoke) {}}

{{      InvocationResponse pi = invokeHandler(handler, msgctx);}}

{{      if (!pi.equals(InvocationResponse.CONTINUE)) {}}
{{        return pi;}}
{{      }}}

{{    }}}

{{    // Set phase index to the next handler}}
{{   msgctx.setCurrentPhaseIndex(i+1);}}

{{ }}}

 

> Module engaged at the service level is used globally
> ----------------------------------------------------
>
>                 Key: AXIS2-5721
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5721
>             Project: Axis2
>          Issue Type: Bug
>          Components: modules
>    Affects Versions: 1.6.3
>            Reporter: Victor
>            Priority: Major
>
> Hi,
> Maybe I misunderstood how Axis2 was meant to work, but I have addressing and rampart present in my modules directory, they are made available in the AxisConfiguration object, then addressing is globally engaged because it is present in the axis2.xml file.
> Later I engage rampart manually on a specific service (by calling engageModule() on the AxisService object) and then the rampart handlers are executed for every request, even not those of the aforementioned service.
> I looked at the code and apparently, engageModule() goes down to call PhaseResolver.engageModuleToOperation(AxisOperation, AxisModule, int) on all the operations of the AxisService, gather all the phases from the global AxisConfiguration object and then add the Handler to the needed phases (Security in this case) within the method PhaseHolder.addHandler(HandlerDescription).
> Obviously, being in an Object-Oriented language, modifying the Phase without cloning it first will impact also the global AxisConfiguration that have references to them as well as all the other PhaseHolder for all the operations that have references to them…
> Is that meant to be? I don't think so but I may be mistaken :)
> Thank you



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]