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


Java MessageContext.IN_FLOW属性代码示例

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


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

示例1: invoke

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,代码行数:18,代码来源:InOnlyMEPHandler.java

示例2: resume

/**
 * 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,代码行数:20,代码来源:AxisEngine.java

示例3: doConcurrentThrottling

/**
 * 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,代码行数:38,代码来源:ThrottleHandler.java

示例4: invoke

/**
 * 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,代码行数:60,代码来源:BaseHandler.java

示例5: invoke

/**
 * 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,代码行数:56,代码来源:SOAPMonitorHandler.java

示例6: getPrimaryMessageUnit

/**
 * 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,代码行数:26,代码来源:MessageContextUtils.java


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