当前位置: 首页>>代码示例>>Java>>正文


Java MessageContext.setCurrentPhaseIndex方法代码示例

本文整理汇总了Java中org.apache.axis2.context.MessageContext.setCurrentPhaseIndex方法的典型用法代码示例。如果您正苦于以下问题:Java MessageContext.setCurrentPhaseIndex方法的具体用法?Java MessageContext.setCurrentPhaseIndex怎么用?Java MessageContext.setCurrentPhaseIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axis2.context.MessageContext的用法示例。


在下文中一共展示了MessageContext.setCurrentPhaseIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: flowComplete

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void flowComplete(MessageContext msgContext) {
    if (isDebugEnabled) {
        log.debug(msgContext.getLogIDString() + " Invoking flowComplete() in Phase \"" +
                phaseName + "\"");
    }

    // This will be non-zero if we failed during execution of one of the
    // handlers in this phase
    int currentHandlerIndex = msgContext.getCurrentPhaseIndex();
    if (currentHandlerIndex == 0) {
        currentHandlerIndex = handlers.size();
    } else {
        /*We need to set it to 0 so that any previous phases will execute all
     * of their handlers.*/
        msgContext.setCurrentPhaseIndex(0);
    }

    for (; currentHandlerIndex > 0; currentHandlerIndex--) {
        Handler handler = (Handler) handlers.get(currentHandlerIndex - 1);

        if (isDebugEnabled) {
            log.debug(msgContext.getLogIDString() + " Invoking flowComplete() for Handler '" +
                    handler.getName() + "' in Phase '" + phaseName + "'");
        }

        handler.flowComplete(msgContext);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:29,代码来源:Phase.java

示例2: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Invoke all the handlers in this Phase
 *
 * @param msgctx the current MessageContext
 * @return An InvocationResponse that indicates what
 *         the next step in the message processing should be.
 * @throws org.apache.axis2.AxisFault
 */
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++) {
        Handler handler = (Handler) handlers.get(i);

        InvocationResponse pi = invokeHandler(handler, msgctx);
       
        if (!pi.equals(InvocationResponse.CONTINUE)) {
            return pi;
        }
        
        // Set phase index to the next handler
        msgctx.setCurrentPhaseIndex(i+1);
    }

    if (isDebugEnabled) {
        log.debug(msgctx.getLogIDString() + " Checking post-conditions for phase \"" +
                phaseName + "\"");
    }

    msgctx.setCurrentPhaseIndex(0);
    checkPostConditions(msgctx);
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:50,代码来源:Phase.java


注:本文中的org.apache.axis2.context.MessageContext.setCurrentPhaseIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。