[prev in list] [next in list] [prev in thread] [next in thread] 

List:       axis-user-ja
Subject:    [jira] [Comment Edited] (AXIS2-5721) Module engaged at the service level is used globally
From:       "Jeff Thomas (Jira)" <jira () apache ! org>
Date:       2020-01-14 23:34:00
Message-ID: JIRA.12868775.1442412770000.33955.1579044840524 () Atlassian ! JIRA
[Download RAW message or body]


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

Jeff Thomas edited comment on AXIS2-5721 at 1/14/20 11:33 PM:
--------------------------------------------------------------

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);

 }

  

Edit: sorry but I am having a horrible time posting code in this editor...adds all \
these silly brackets.

  


was (Author: jwt007):
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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic