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


Java MessageContext.isServerSide方法代码示例

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


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

示例1: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {

        // is there a transport url which may be different to the WS-A To but has higher precedence
        String targetAddress = (String) msgContext.getProperty(
            Constants.Configuration.TRANSPORT_URL);

        if (targetAddress != null) {
            sendMessage(msgContext, targetAddress, null);
        } else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
            targetAddress = msgContext.getTo().getAddress();

            if (!msgContext.getTo().hasNoneAddress()) {
                sendMessage(msgContext, targetAddress, null);
            } else {
                //Don't send the message.
                return InvocationResponse.CONTINUE;
            }
        } else if (msgContext.isServerSide()) {
            // get the out transport info for server side when target EPR is unknown
            sendMessage(msgContext, null,
                (OutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO));
        }

        return InvocationResponse.CONTINUE;
    }
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:26,代码来源:AbstractTransportSender.java

示例2: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext)
		throws AxisFault {
       String targetAddress = (String) msgContext.getProperty(
               Constants.Configuration.TRANSPORT_URL);
           if (targetAddress != null) {
               sendMessage(msgContext, targetAddress, null);
           } else if (msgContext.getTo() != null && !msgContext.getTo().hasAnonymousAddress()) {
               targetAddress = msgContext.getTo().getAddress();

               if (!msgContext.getTo().hasNoneAddress()) {
                   sendMessage(msgContext, targetAddress, null);
               } else {
                   //Don't send the message.
                   return InvocationResponse.CONTINUE;
               }
           } else if (msgContext.isServerSide()) {
               // get the out transport info for server side when target EPR is unknown
               sendMessage(msgContext, null,
                   (OutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO));
           }
           return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:23,代码来源:XMPPSender.java

示例3: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
* Checks if the message should be MTOMised. If it is not but the policy states that it should be </br>
* then an {@link AxisFault} is thrown.
   * 
   * @param msgCtx the {@link MessageContext}
   * 
   * @throws AxisFault if the message is not MTOMised, but the policy states so.
*/
  public InvocationResponse invoke(MessageContext msgCtx) throws AxisFault {
      Policy policy = msgCtx.getEffectivePolicy();
      if (policy == null) {
          return InvocationResponse.CONTINUE;
      }
      List<Assertion> list = (List<Assertion>) policy.getAlternatives()
              .next();
      for (Assertion assertion : list) {
          if (assertion instanceof MTOMAssertion) {
              String contentType = (String) msgCtx.getProperty(Constants.Configuration.CONTENT_TYPE);
              if (!assertion.isOptional()) {
                  if (contentType == null || contentType.indexOf(MTOMConstants.MTOM_TYPE) == -1) {
                      if (msgCtx.isServerSide()) {
                      throw new AxisFault(
                              "The SOAP REQUEST sent by the client IS NOT MTOMized!");
                      } else {
                          throw new AxisFault(
                          "The SOAP RESPONSE sent by the service IS NOT MTOMized!");
                      }
                  }
              }
          }
      }
      return InvocationResponse.CONTINUE;
  }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:34,代码来源:MTOMInHandler.java

示例4: getMtomThreshold

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public static int getMtomThreshold(MessageContext msgCtxt){
	Integer value = null;
    if(!msgCtxt.isServerSide()){
     value = (Integer)msgCtxt.getProperty(Constants.Configuration.MTOM_THRESHOLD);
    }else{
    	Parameter param = msgCtxt.getParameter(Constants.Configuration.MTOM_THRESHOLD);
    	if(param!=null){
    		value = (Integer)param.getValue();
    	}
    }
    int threshold = (value!=null)?value.intValue():0;
    if(log.isDebugEnabled()){
    	log.debug("MTOM optimized Threshold value ="+threshold);
    }
    return threshold;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:Utils.java

示例5: sendMessage

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
@Override
public void sendMessage(MessageContext msgContext, String targetEPR,
                        OutTransportInfo outTransportInfo) throws AxisFault {
    UDPOutTransportInfo udpOutInfo;
    if ((targetEPR == null) && (outTransportInfo != null)) {
        // this can happen only at the server side and send the message using back chanel
        udpOutInfo = (UDPOutTransportInfo) outTransportInfo;
    } else {
        udpOutInfo = new UDPOutTransportInfo(targetEPR);
    }
    MessageFormatter messageFormatter = MessageProcessorSelector.getMessageFormatter(msgContext);
    OMOutputFormat format = BaseUtils.getOMOutputFormat(msgContext);
    format.setContentType(udpOutInfo.getContentType());
    byte[] payload = messageFormatter.getBytes(msgContext, format);
    try {
        DatagramSocket socket = new DatagramSocket();
        if (log.isDebugEnabled()) {
            log.debug("Sending " + payload.length + " bytes to " + udpOutInfo.getAddress());
        }
        try {
            socket.send(new DatagramPacket(payload, payload.length, udpOutInfo.getAddress()));
            if (!msgContext.getOptions().isUseSeparateListener() &&
                    !msgContext.isServerSide()){
                waitForReply(msgContext, socket, udpOutInfo.getContentType());
            }
        }
        finally {
            socket.close();
        }
    }
    catch (IOException ex) {
        throw new AxisFault("Unable to send packet", ex);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:35,代码来源:UDPSender.java

示例6: handleIncomingMessage

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Process a new incoming message (Response) through the axis engine
 * @param msgCtx the axis MessageContext
 * @param trpHeaders the map containing transport level message headers
 * @param soapAction the optional soap action or null
 * @param contentType the optional content-type for the message
 */
public void handleIncomingMessage(
    MessageContext msgCtx, Map trpHeaders,
    String soapAction, String contentType) {

    // set the soapaction if one is available via a transport header
    if (soapAction != null) {
        msgCtx.setSoapAction(soapAction);
    }

    // set the transport headers to the message context
    msgCtx.setProperty(MessageContext.TRANSPORT_HEADERS, trpHeaders);
    
    // send the message context through the axis engine
    try {
            try {
                AxisEngine.receive(msgCtx);
            } catch (AxisFault e) {
                if (log.isDebugEnabled()) {
                    log.debug("Error receiving message", e);
                }
                if (msgCtx.isServerSide()) {
                    AxisEngine.sendFault(MessageContextBuilder.createFaultMessageContext(msgCtx, e));
                }
            }
    } catch (AxisFault axisFault) {
        logException("Error processing response message", axisFault);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:36,代码来源:AbstractTransportSender.java

示例7: run

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void run() {
	MessageContext msgCtx = null;
	try {
		msgCtx = createMessageContext(packet);
		Object obj = msgCtx.getProperty(XMPPConstants.CONTAINS_SOAP_ENVELOPE);
		if(obj != null && ((Boolean)obj).booleanValue()){
			if(msgCtx.isProcessingFault() && msgCtx.isServerSide()){
				AxisEngine.sendFault(msgCtx);
			}else{
				AxisEngine.receive(msgCtx);
			}					
		}else{
			//Send a text reply message to command received from chat client
			XMPPSender.processChatMessage(msgCtx);
		}
	} catch (AxisFault e) {
		log.error("Error occurred while sending message"+e);
 				if (msgCtx != null && msgCtx.isServerSide()) {
  				MessageContext faultContext;
			try {
				faultContext = MessageContextBuilder.createFaultMessageContext(msgCtx, e);
   				AxisEngine.sendFault(faultContext);
			} catch (AxisFault e1) {
				log.error("Error occurred while creating SOAPFault message"+e1);
			}
 				}
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:29,代码来源:XMPPPacketListener.java

示例8: checkUsingAddressing

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Check that if the wsaddressing="required" attribute exists on the service definition
 * (or AddressingFeature on the client) or <wsaw:UsingAddressing wsdl:required="true" />
 * was found in the WSDL (provider side only) that WS-Addressing headers were found on
 * the inbound message.
 */
private void checkUsingAddressing(MessageContext msgContext)
        throws AxisFault {
    String addressingFlag;
    if (!msgContext.isServerSide()) {
        // On client side, get required value from the request message context
        // (set by AddressingConfigurator).
        // We do not use the UsingAddressing required attribute on the
        // client side since it is not generated/processed by java tooling.
        addressingFlag = AddressingHelper.getRequestAddressingRequirementParameterValue(msgContext);
        if (log.isTraceEnabled()) {
            log.trace("checkUsingAddressing: WSAddressingFlag from MessageContext=" + addressingFlag);
        }
    } else {
        // On provider side, get required value from AxisOperation
        // (set by AddressingConfigurator and UsingAddressing WSDL processing).
        AxisDescription ad = msgContext.getAxisService();
        if(msgContext.getAxisOperation()!=null){
    	   ad = msgContext.getAxisOperation();
        }
        addressingFlag =
            AddressingHelper.getAddressingRequirementParemeterValue(ad);
        if (log.isTraceEnabled()) {
            log.trace("checkUsingAddressing: WSAddressingFlag from AxisOperation=" + addressingFlag);
        }
    }
    if (AddressingConstants.ADDRESSING_REQUIRED.equals(addressingFlag)) {
        AddressingFaultsHelper.triggerMessageAddressingRequiredFault(msgContext,
                                                                     AddressingConstants.WSA_ACTION);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:37,代码来源:AddressingValidationHandler.java

示例9: setDefaults

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private void setDefaults(boolean[] alreadyFoundAddrHeader, MessageContext messageContext, String namespace) {
    if (Final.WSA_NAMESPACE.equals(namespace)) {
        //According to the WS-Addressing spec, we should default the wsa:To header to the
        //anonymous URI. Doing that, however, might prevent a different value from being
        //used instead, such as the transport URL. Therefore, we only apply the default
        //on the inbound response side of a synchronous request-response exchange.
        if (!alreadyFoundAddrHeader[TO_FLAG] && !messageContext.isServerSide()) {
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(messageContext.getLogIDString() +
                " setDefaults: Setting WS-Addressing default value for the To property.");
            }
            messageContext.setTo(new EndpointReference(Final.WSA_ANONYMOUS_URL));
        }
        
        if (!alreadyFoundAddrHeader[REPLYTO_FLAG]) {
            messageContext.setReplyTo(new EndpointReference(Final.WSA_ANONYMOUS_URL));
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(messageContext.getLogIDString() +
                " setDefaults: Setting WS-Addressing default value for the ReplyTo property.");
            }
        }
    }
    else {
        //The none URI is not defined in the 2004/08 spec, but it is used here anyway
        //as a flag to indicate the correct semantics to apply, i.e. in the 2004/08 spec
        //the absence of a ReplyTo header indicates that a response is NOT required.
        if (!alreadyFoundAddrHeader[REPLYTO_FLAG]) {
            messageContext.setReplyTo(new EndpointReference(Final.WSA_NONE_URI));
            if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                log.trace(
                        "setDefaults: Setting WS-Addressing default value for the ReplyTo property.");
            }
        }            
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:36,代码来源:AddressingInHandler.java

示例10: invoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
    AxisOperation op = msgContext.getAxisOperation();       
    if (!msgContext.isServerSide() && op != null && isAnonymousOperation(op)) {
        op = findRealOperationAction(msgContext);         
        if (op != null) {
            msgContext.setAxisOperation(op);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Anonymous operation detected. Replaced with real operation: " + op);
            }
        }
    }                
    return InvocationResponse.CONTINUE;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:14,代码来源:DispatchOperationHandler.java

示例11: isReceiverMustUnderstandProcessor

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private static boolean isReceiverMustUnderstandProcessor(MessageContext msgContext){
    MessageReceiver receiver = null;
    if(msgContext.isServerSide()){
        receiver = msgContext.getAxisOperation().getMessageReceiver();
    }
    return (receiver!=null && receiver.getClass().getName().endsWith("JAXWSMessageReceiver"));
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:8,代码来源:AxisEngine.java

示例12: resumeReceive

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * If the msgConetext is puased and try to invoke then
 * first invoke the phase list and after the message receiver
 *
 * @param msgContext
 * @return An InvocationResponse allowing the invoker to perhaps determine
 *         whether or not the message processing will ever succeed.
 * @throws AxisFault
 */
public static InvocationResponse resumeReceive(MessageContext msgContext) throws AxisFault {
    if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
        log.trace(msgContext.getLogIDString() + " resumeReceive:" + msgContext.getMessageID());
    }

    //REVIEW: This name is a little misleading, as it seems to indicate that there should be a resumeReceiveFault as well, when, in fact, this does both
    //REVIEW: Unlike with receive, there is no wrapping try/catch clause which would
    //fire off the flowComplete on an error, as we have to assume that the
    //message will be resumed again, but perhaps we need to unwind back to
    //the point at which the message was resumed and provide another API
    //to allow the full unwind if the message is going to be discarded.
    //invoke the phases
    InvocationResponse pi = invoke(msgContext, RESUMING_EXECUTION);
    //invoking the MR

    if (pi.equals(InvocationResponse.CONTINUE)) {
        checkMustUnderstand(msgContext);
        if (msgContext.isServerSide()) {
            // invoke the Message Receivers
            MessageReceiver receiver = msgContext.getAxisOperation().getMessageReceiver();
            if (receiver == null) {
                throw new AxisFault(Messages.getMessage(
                        "nomessagereciever",
                        msgContext.getAxisOperation().getName().toString()));
            }
            receiver.receive(msgContext);
        }
        flowComplete(msgContext);
    }

    return pi;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:42,代码来源:AxisEngine.java

示例13: getContentType

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public static String getContentType(String contentType, MessageContext msgContext) {
    String type;
    int index = contentType.indexOf(';');
    if (index > 0) {
        type = contentType.substring(0, index);
    } else {
        int commaIndex = contentType.indexOf(',');
        if (commaIndex > 0) {
            type = contentType.substring(0, commaIndex);
        } else {
            type = contentType;
        }
    }
    // Some services send REST responces as text/xml. We should convert it to
    // application/xml if its a REST response, if not it will try to use the SOAPMessageBuilder.
    // isDoingREST should already be properly set by HTTPTransportUtils.initializeMessageContext
    if (msgContext.isDoingREST() && HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type)) {
        if (msgContext.isServerSide()) {
            if (msgContext.getSoapAction() == null) {
            	// TODO - remove this logic.
                // type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
            }
        } else if (!msgContext.isPropertyTrue(Constants.Configuration.SOAP_RESPONSE_MEP)) {
            type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
        }
    }
    return type;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:29,代码来源:TransportUtils.java

示例14: setupCorrectTransportOut

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * Ensure that if the scheme of the To EPR for the response is different than the
 * transport used for the request that the correct TransportOut is available
 */
private static void setupCorrectTransportOut(MessageContext context) throws AxisFault {
    // Determine that we have the correct transport available.
    TransportOutDescription transportOut = context.getTransportOut();

    try {
        EndpointReference responseEPR = context.getTo();
        if (context.isServerSide() && responseEPR != null) {
            if (!responseEPR.hasAnonymousAddress() && !responseEPR.hasNoneAddress()) {
                URI uri = new URI(responseEPR.getAddress());
                String scheme = uri.getScheme();
                if ((transportOut == null) || !transportOut.getName().equals(scheme)) {
                    ConfigurationContext configurationContext =
                            context.getConfigurationContext();
                    transportOut = configurationContext.getAxisConfiguration()
                            .getTransportOut(scheme);
                    if (transportOut == null) {
                        throw new AxisFault("Can not find the transport sender : " + scheme);
                    }
                    context.setTransportOut(transportOut);
                }
                if (context.getOperationContext() != null) {
                    context.getOperationContext().setProperty(
                            Constants.DIFFERENT_EPR, Constants.VALUE_TRUE);
                }
            }
        }
    } catch (URISyntaxException urise) {
        throw AxisFault.makeFault(urise);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:35,代码来源:MessageContextBuilder.java

示例15: 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


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