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


Java MessageContext.getFLOW方法代码示例

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


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

示例1: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
    if (msgContext.getEnvelope() == null) {
        return InvocationResponse.CONTINUE;
    }
    if (msgContext.getFLOW() != MessageContext.IN_FLOW &&
        msgContext.getFLOW() != MessageContext.IN_FAULT_FLOW) {
        log.error("InOnlyMEPHandler not deployed in IN/IN_FAULT flow. Flow: " +
                  msgContext.getFLOW());
        return InvocationResponse.CONTINUE;
    }
    try {
        msgContext.setProperty(StatisticsConstants.REQUEST_RECEIVED_TIME,
                               "" + System.currentTimeMillis());
    } catch (Throwable e) { // Catching Throwable since exceptions here should not be propagated up
        log.error("Could not call InOnlyMEPHandler.invoke", e);
    }
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:19,代码来源:InOnlyMEPHandler.java

示例2: resume

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Resume processing of a message.
 *
 * @param msgctx
 * @return An InvocationResponse allowing the invoker to perhaps determine
 *         whether or not the message processing will ever succeed.
 * @throws AxisFault
 */
public static InvocationResponse resume(MessageContext msgctx) throws AxisFault {
    if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
        log.trace(msgctx.getLogIDString() + " resume:" + msgctx.getMessageID());
    }

    msgctx.setPaused(false);
    if (msgctx.getFLOW() == MessageContext.IN_FLOW) {
        return resumeReceive(msgctx);
    } else {
        return resumeSend(msgctx);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:AxisEngine.java

示例3: doConcurrentThrottling

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Helper method for handling concurrent throttling
 *
 * @param concurrentAccessController ConcurrentAccessController
 * @param messageContext             MessageContext - message level states
 * @return true if access is allowed through concurrent throttling ,o.w false
 */
private boolean doConcurrentThrottling(ConcurrentAccessController concurrentAccessController, MessageContext messageContext) {

    boolean canAccess = true;
    int available;

    if (concurrentAccessController != null) {
        if (messageContext.getFLOW() == MessageContext.IN_FLOW) {
            available = concurrentAccessController.getAndDecrement();
            canAccess = available > 0;
            if (debugOn) {
                log.debug("Concurrency Throttle : Access " + (canAccess ? "allowed" : "denied") +
                        " :: " + available + " of available of " +
                        concurrentAccessController.getLimit() + " connections");
            }
            if (debugOn) {
                if (!canAccess) {
                    log.debug("Concurrency Throttle : Access has currently been denied since allowed" +
                            " maximum concurrent access have exceeded");
                }
            }
        } else if (messageContext.getFLOW() == MessageContext.OUT_FLOW) {
            available = concurrentAccessController.incrementAndGet();
            if (debugOn) {
                log.debug("Concurrency Throttle : Connection returned" +
                        " :: " + available + " of available of "
                        + concurrentAccessController.getLimit() + " connections");
            }
        }
    }
    return canAccess;
}
 
开发者ID:wso2-attic,项目名称:carbon-qos,代码行数:39,代码来源:ThrottleHandler.java

示例4: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Prepares the handler for processing of the message. Checks if the handler is run in the correct flow and
 * creates a correctly named {@link Log}.
 * <p>NOTE: To prevent sub classes from overriding this method it is declared final.
 *
 * @param mc            The Axis2 {@link MessageContext}. Will be passed onto the implementation for the actual
 *                      processing
 * @return              The result of the message processing, i.e. the result of
 *                      {@link #doProcessing(org.apache.axis2.context.MessageContext)} of the implementation
 * @throws AxisFault    If an error occurs during the processing of the message that should prevent further
 *                      processing. Note that this will stop processing of the complete flow and may leave message
 *                      units in an undefined state!
 */
public final InvocationResponse invoke(final MessageContext mc) throws AxisFault {
    // Determine which flow the handler currently runs is
    if (mc.isServerSide()) {
        // Running serverside means Holodeck B2B acts as responder
        currentFlow = RESPONDER;
        currentFlowName = "RESPONDER_";
    } else {
        currentFlow = INITIATOR;
        currentFlowName = "INITIATOR_";
    }
    switch (mc.getFLOW()) {
        case MessageContext.IN_FLOW :
            currentFlowName += "IN_FLOW"; currentFlow |= IN_FLOW;
            break;
        case MessageContext.IN_FAULT_FLOW :
            currentFlowName += "IN_FAULT_FLOW"; currentFlow |= IN_FAULT_FLOW;
            break;
        case MessageContext.OUT_FLOW :
            currentFlowName += "OUT_FLOW"; currentFlow |= OUT_FLOW;
            break;
        case MessageContext.OUT_FAULT_FLOW :
            currentFlowName += "OUT_FAULT_FLOW"; currentFlow |= OUT_FAULT_FLOW;
            break;
    }

    // Check if running in correct flow (check has two parts, first check the for IN or OUT flow,
    //   then check whether message is initiated by Holodeck B2B or response)
    if (!runningInCorrectFlow()) {
        // This is handler is not supposed to run in the current flow
        return InvocationResponse.CONTINUE;
    }

    // Running in correct flow, create a logger
    log = LogFactory.getLog("org.holodeckb2b.msgproc." + currentFlowName + "." + this.getClass().getSimpleName());

    // Do actual processing in implementation
    try {
        log.trace("Start processing");
        final InvocationResponse result = doProcessing(mc);
        log.trace("End processing");
        return result;
    } catch (final Throwable t) {
        // Unhandled exception during processing, should not happen!
        log.fatal("An unhandled exception occurred while processing the message! Details: " + t.getMessage());
        throw new AxisFault("Internal error", t);
    }
}
 
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:61,代码来源:BaseHandler.java

示例5: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Process and SOAP message
 */
public InvocationResponse invoke(MessageContext messageContext) throws AxisFault {

    EndpointReference ref = null;

    // Get id, type and content
    Long id;
    Integer type;
    // 'soap request' must be called first
    if (messageContext.getFLOW() == MessageContext.IN_FLOW) {
        // show soap message inside the 'soap request' pane in the applet
        id = assignMessageId(messageContext);
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_REQUEST);
        ref = messageContext.getTo();
    } else if (messageContext.getFLOW() == MessageContext.OUT_FLOW) {
        id = getMessageId(messageContext);
        // show soap message inside the 'soap response' pane in the applet
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_RESPONSE);
        ref = messageContext.getFrom();
    } else if (messageContext.getFLOW() == MessageContext.IN_FAULT_FLOW) {
        id = getMessageId(messageContext);
        // show soap message inside the 'soap request' pane in the applet
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_REQUEST);
        ref = messageContext.getFaultTo();
    } else if (messageContext.getFLOW() == MessageContext.OUT_FAULT_FLOW) {
        id = getMessageId(messageContext);
        // show soap message inside the 'soap response' pane in the applet
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_RESPONSE);
        // TODO - How do I get an EPR on MessageContext.OUT_FAULT_FLOW ?
    } else {
        throw new IllegalStateException("unknown FLOW detected in messageContext: " + messageContext.getFLOW());
    }

    String target = null;
    if (ref != null) {
        target = ref.getAddress();
    }
    // Check for null target
    if (target == null) {
        target = "";
    }

    // Get the SOAP portion of the message
    String soap = null;
    if (messageContext.getEnvelope() != null) {
        soap = messageContext.getEnvelope().toString();
    }
    // If we have an id and a SOAP portion, then send the
    // message to the SOAP monitor service
    if ((id != null) && (soap != null)) {
        SOAPMonitorService.publishMessage(id, type, target, soap);
    }
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:57,代码来源:SOAPMonitorHandler.java

示例6: getBytes

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Get the bytes for this message
 * @param messageContext
 * @param format
 * @param preserve (indicates if the OM should be preserved or consumed)
 * @return
 * @throws AxisFault
 */
public byte[] getBytes(MessageContext messageContext, 
                       OMOutputFormat format, 
                       boolean preserve) throws AxisFault {

    if (log.isDebugEnabled()) {
        log.debug("start getBytes()");
        log.debug("  fault flow=" + 
                  (messageContext.getFLOW() == MessageContext.OUT_FAULT_FLOW));
    }
    try {
        OMElement omElement;

        // Find the correct element to serialize.  Normally it is the first element
        // in the body.  But if this is a fault, use the detail entry element or the 
        // fault reason.
        if (messageContext.getFLOW() == MessageContext.OUT_FAULT_FLOW) {
            SOAPFault fault = messageContext.getEnvelope().getBody().getFault();
            SOAPFaultDetail soapFaultDetail = fault.getDetail();
            omElement = soapFaultDetail.getFirstElement();

            if (omElement == null) {
                omElement = fault.getReason();
            }

        } else {
            // Normal case: The xml payload is the first element in the body.
            omElement = messageContext.getEnvelope().getBody().getFirstElement();
        }
        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();

        if (omElement != null) {

            try {
                if (preserve) {
                    omElement.serialize(bytesOut, format);
                } else {
                    omElement.serializeAndConsume(bytesOut, format);
                }
            } catch (XMLStreamException e) {
                throw AxisFault.makeFault(e);
            }

            return bytesOut.toByteArray();
        }

        return new byte[0];
    } finally {
        if (log.isDebugEnabled()) {
            log.debug("end getBytes()");
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:61,代码来源:ApplicationXMLFormatter.java

示例7: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext outMsgContext) throws AxisFault {
    if(outMsgContext.getEnvelope() == null){
        return InvocationResponse.CONTINUE;
    }
    if (outMsgContext.getFLOW() != MessageContext.OUT_FLOW &&
        outMsgContext.getFLOW() != MessageContext.OUT_FAULT_FLOW) {
        log.error("InOutMEPHandler not deployed in OUT/OUT_FAULT flow. Flow: " +
                  outMsgContext.getFLOW());
        return InvocationResponse.CONTINUE;
    }
    try {
        AxisService axisService = outMsgContext.getAxisService();
        if(axisService == null) {
           updateStatistics(outMsgContext);
           return InvocationResponse.CONTINUE;
       } else if (SystemFilter.isFilteredOutService(axisService.getAxisServiceGroup()) ||
           axisService.isClientSide()) {
           return InvocationResponse.CONTINUE;
       }

        final AxisOperation axisOperation = outMsgContext.getAxisOperation();
        if(axisOperation != null && axisOperation.isControlOperation()){
            return InvocationResponse.CONTINUE;
        }
        if (axisOperation != null) {
            String mep = axisOperation.getMessageExchangePattern();
            if (mep != null &&
                (mep.equals(WSDL2Constants.MEP_URI_OUT_IN) ||
                    mep.equals(WSDL2Constants.MEP_URI_OUT_ONLY) ||
                    mep.equals(WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN))) { // If this ConfigurationContext is used for sending messages out, do not change the stats
                return InvocationResponse.CONTINUE;
            }
            // Process operation request count
            Parameter inOpCounter =
                axisOperation.getParameter(StatisticsConstants.IN_OPERATION_COUNTER);
            if (inOpCounter != null) {
                ((AtomicInteger) inOpCounter.getValue()).incrementAndGet();
            } else {
                log.error(StatisticsConstants.IN_OPERATION_COUNTER +
                          " has not been set for operation " +
                          axisService.getName() + "." + axisOperation.getName());
                return InvocationResponse.CONTINUE;
            }

            // Process operation response count
            Parameter outOpCounter =
                axisOperation.getParameter(StatisticsConstants.OUT_OPERATION_COUNTER);
            if (outOpCounter != null) {
                ((AtomicInteger) outOpCounter.getValue()).incrementAndGet();
            } else {
                log.error(StatisticsConstants.OUT_OPERATION_COUNTER +
                          " has not been set for operation " +
                          axisService.getName() + "." + axisOperation.getName());
                return InvocationResponse.CONTINUE;
            }
        }
        updateStatistics(outMsgContext);
    } catch (Throwable e) {
        log.error("Could not call InOutMEPHandler.invoke", e);
     }
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:63,代码来源:InOutMEPHandler.java

示例8: getPrimaryMessageUnit

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Gets the primary message unit from a message. The primary message unit determines which settings must be used for
 * message wide P-Mode parameters, i.e. parameters that do not relate to the content of a specific message unit.
 * Examples are the destination URL for a message and the WS-Security settings.
 * <p>The primary message unit is determined by the type of message unit, but differs depending on whether the
 * message is sent or received by Holodeck B2B. The following table lists the priority of message unit types for
 * each direction, the first message unit with the highest classified type is considered to be the primary message
 * unit of the message:
 * <table border="1">
 * <tr><th>Prio</th><th>Received</th><th>Sent</th></tr>
 * <tr><td>1</td><td>User message</td><td>Pull request</td></tr>
 * <tr><td>2</td><td>Receipt</td><td>User message</td></tr>
 * <tr><td>3</td><td>Error</td><td>Receipt</td></tr>
 * <tr><td>4</td><td>Pull request</td><td>Error</td></tr>
 * </table>
 *
 * @param mc    The {@link MessageContext} of the message
 * @return      The entity object of the primary message unit if one was found, or
 *              <code>null</code> if no message unit could be found in the message context
 */
public static IMessageUnitEntity getPrimaryMessageUnit(final MessageContext mc) {
    if (mc.getFLOW() == MessageContext.IN_FLOW || mc.getFLOW() == MessageContext.IN_FAULT_FLOW)
        return getPrimaryMessageUnitFromInFlow(mc);
    else
        return getPrimaryMessageUnitFromOutFlow(mc);
}
 
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:27,代码来源:MessageContextUtils.java


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