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


Java MessageContext.getParameter方法代码示例

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


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

示例1: getUserAgent

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private String getUserAgent(MessageContext messageContext) {
    String userAgentString = "Axis2";
    boolean locked = false;
    if (messageContext.getParameter(HTTPConstants.USER_AGENT) != null) {
        OMElement userAgentElement =
                messageContext.getParameter(HTTPConstants.USER_AGENT).getParameterElement();
        userAgentString = userAgentElement.getText().trim();
        OMAttribute lockedAttribute = userAgentElement.getAttribute(new QName("locked"));
        if (lockedAttribute != null) {
            if (lockedAttribute.getAttributeValue().equalsIgnoreCase("true")) {
                locked = true;
            }
        }
    }
    // Runtime overing part
    if (!locked) {
        if (messageContext.getProperty(HTTPConstants.USER_AGENT) != null) {
            userAgentString = (String) messageContext.getProperty(HTTPConstants.USER_AGENT);
        }
    }

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

示例2: getMessageFormatterProperty

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private static String getMessageFormatterProperty(MessageContext msgContext) {
    String messageFormatterProperty = null;
    Object property = msgContext
            .getProperty(Constants.Configuration.MESSAGE_TYPE);
    if (property != null) {
        messageFormatterProperty = (String) property;
    }
    if (messageFormatterProperty == null) {
        Parameter parameter = msgContext
                .getParameter(Constants.Configuration.MESSAGE_TYPE);
        if (parameter != null) {
            messageFormatterProperty = (String) parameter.getValue();
        }
    }
    return messageFormatterProperty;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:MessageProcessorSelector.java

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

示例4: isAttachmentsCacheEnabled

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public static boolean isAttachmentsCacheEnabled(MessageContext msgContext) {
    Object cacheAttachmentProperty = msgContext
            .getProperty(Constants.Configuration.CACHE_ATTACHMENTS);
    String cacheAttachmentString;
    boolean fileCacheForAttachments;

    if (cacheAttachmentProperty != null && cacheAttachmentProperty instanceof String) {
        cacheAttachmentString = (String)cacheAttachmentProperty;
    } else {
        Parameter parameter_cache_attachment =
                msgContext.getParameter(Constants.Configuration.CACHE_ATTACHMENTS);
        cacheAttachmentString = (parameter_cache_attachment != null) ?
                (String)parameter_cache_attachment.getValue() : null;
    }
    fileCacheForAttachments = (Constants.VALUE_TRUE.equals(cacheAttachmentString));
    return fileCacheForAttachments;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:18,代码来源:BuilderUtil.java

示例5: updateStatistics

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private void updateStatistics(MessageContext msgContext) throws AxisFault {
    // Process System Request count
    Parameter globalRequestCounter =
        msgContext.getParameter(StatisticsConstants.GLOBAL_REQUEST_COUNTER);
    ((AtomicInteger) globalRequestCounter.getValue()).incrementAndGet();

    // Increment the global fault count
    Parameter globalFaultCounter =
            msgContext.getParameter(StatisticsConstants.GLOBAL_FAULT_COUNTER);
    ((AtomicInteger) globalFaultCounter.getValue()).incrementAndGet();

    updateCurrentInvocationGlobalStatistics(msgContext);

    // Calculate response times
    ResponseTimeCalculator.calculateResponseTimes(msgContext);
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:17,代码来源:FaultHandler.java

示例6: updateStatistics

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private void updateStatistics(MessageContext outMsgContext) throws AxisFault {
    // Process System Request count
    Parameter globalRequestCounter =
        outMsgContext.getParameter(StatisticsConstants.GLOBAL_REQUEST_COUNTER);
    ((AtomicInteger) globalRequestCounter.getValue()).incrementAndGet();

    // Process System Response count
    Parameter globalResponseCounter =
        outMsgContext.getParameter(StatisticsConstants.GLOBAL_RESPONSE_COUNTER);
    ((AtomicInteger) globalResponseCounter.getValue()).incrementAndGet();

    updateCurrentInvocationGlobalStatistics(outMsgContext);

    // Calculate response times
    ResponseTimeCalculator.calculateResponseTimes(outMsgContext);
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:17,代码来源:InOutMEPHandler.java

示例7: shouldInvoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
    //Set the defaults on the message context.
    msgContext.setProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
    msgContext.setProperty(IS_ADDR_INFO_ALREADY_PROCESSED, Boolean.FALSE);

    //Determine if we want to ignore addressing headers. This parameter must
    //be retrieved from the message context because it's value can vary on a
    //per service basis.
    Parameter disableParam = msgContext.getParameter(DISABLE_ADDRESSING_FOR_IN_MESSAGES);
    Object disableProperty = msgContext.getProperty(DISABLE_ADDRESSING_FOR_IN_MESSAGES);
    String value = Utils.getParameterValue(disableParam);
    if (JavaUtils.isTrueExplicitly(value)) {
        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
            log.debug(
                    "The AddressingInHandler has been disabled. No further processing will take place.");
        }
        return false;         
    } else if (JavaUtils.isTrueExplicitly(disableProperty)) {
        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
            log.debug(
                    "The AddressingInHandler has been disabled. No further processing will take place.");
        }
        return false;
    }

    // if there are not headers put a flag to disable addressing temporary
    SOAPHeader header = msgContext.getEnvelope().getHeader();
    return header != null;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:30,代码来源:AddressingInHandler.java

示例8: getClassLoader

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public ClassLoader getClassLoader() {
    MessageContext context = getMessageContext();
    if (context != null) {
        Parameter param = context.getParameter(Constants.CACHE_CLASSLOADER);
        if (param != null) {
            return (ClassLoader) param.getValue();
        }
    }
    return null;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:11,代码来源:JAXBDSContext.java

示例9: doWriteMTOM

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * <p>
 * Checks whether MTOM needs to be enabled for the message represented by
 * the msgContext. We check value assigned to the "enableMTOM" property
 * either using the config files (axis2.xml, services.xml) or
 * programatically. Programatic configuration is given priority. If the
 * given value is "optional", MTOM will be enabled only if the incoming
 * message was an MTOM message.
 * </p>
 *
 * @param msgContext the active MessageContext
 * @return true if SwA needs to be enabled
 */
public static boolean doWriteMTOM(MessageContext msgContext) {
    boolean enableMTOM;
    Object enableMTOMObject = null;
    // First check the whether MTOM is enabled by the configuration
    // (Eg:Axis2.xml, services.xml)
    Parameter parameter = msgContext.getParameter(Constants.Configuration.ENABLE_MTOM);
    if (parameter != null) {
        enableMTOMObject = parameter.getValue();
    }
    // Check whether the configuration is overridden programatically..
    // Priority given to programatically setting of the value
    Object property = msgContext.getProperty(Constants.Configuration.ENABLE_MTOM);
    if (property != null) {
        enableMTOMObject = property;
    }
    enableMTOM = JavaUtils.isTrueExplicitly(enableMTOMObject);
    // Handle the optional value for enableMTOM
    // If the value for 'enableMTOM' is given as optional and if the request
    // message was a MTOM message we sent out MTOM
    if (!enableMTOM && msgContext.isDoingMTOM() && (enableMTOMObject instanceof String)) {
        if (((String) enableMTOMObject).equalsIgnoreCase(Constants.VALUE_OPTIONAL)) {
            //In server side, we check whether request was MTOM
            if (msgContext.isServerSide()) {
                if (msgContext.isDoingMTOM()) {
                    enableMTOM = true;
                }
                // in the client side, we enable MTOM if it is optional
            } else {
                enableMTOM = true;
            }
        }
    }
    return enableMTOM;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:48,代码来源:TransportUtils.java

示例10: doWriteSwA

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * <p>
 * Checks whether SOAP With Attachments (SwA) needs to be enabled for the
 * message represented by the msgContext. We check value assigned to the
 * "enableSwA" property either using the config files (axis2.xml,
 * services.xml) or programatically. Programatic configuration is given
 * priority. If the given value is "optional", SwA will be enabled only if
 * the incoming message was SwA type.
 * </p>
 *
 * @param msgContext the active MessageContext
 * @return true if SwA needs to be enabled
 */
public static boolean doWriteSwA(MessageContext msgContext) {
    boolean enableSwA;
    Object enableSwAObject = null;
    // First check the whether SwA is enabled by the configuration
    // (Eg:Axis2.xml, services.xml)
    Parameter parameter = msgContext.getParameter(Constants.Configuration.ENABLE_SWA);
    if (parameter != null) {
        enableSwAObject = parameter.getValue();
    }
    // Check whether the configuration is overridden programatically..
    // Priority given to programatically setting of the value
    Object property = msgContext.getProperty(Constants.Configuration.ENABLE_SWA);
    if (property != null) {
        enableSwAObject = property;
    }
    enableSwA = JavaUtils.isTrueExplicitly(enableSwAObject);
    // Handle the optional value for enableSwA
    // If the value for 'enableSwA' is given as optional and if the request
    // message was a SwA message we sent out SwA
    if (!enableSwA && msgContext.isDoingSwA() && (enableSwAObject instanceof String)) {
        if (((String) enableSwAObject).equalsIgnoreCase(Constants.VALUE_OPTIONAL)) {
            enableSwA = true;
        }
    }
    return enableSwA;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:40,代码来源:TransportUtils.java

示例11: getFaultReasonFromException

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * By the time the exception comes here it can be wrapped by so many levels. This will crip down
 * to the root cause and get the initial error depending on the property
 *
 * @param e exception to get the string representation
 * @param context current message context for which the exception occurred
 * @return generated fault reason as a string
 */
private static String getFaultReasonFromException(Throwable e, MessageContext context) {
    Throwable throwable = e;
    Parameter param = context.getParameter(
            Constants.Configuration.DRILL_DOWN_TO_ROOT_CAUSE_FOR_FAULT_REASON);
    boolean drillDownToRootCauseForFaultReason =
            param != null && ((String) param.getValue()).equalsIgnoreCase("true");
    if (drillDownToRootCauseForFaultReason) {
        while (throwable.getCause() != null) {
            throwable = throwable.getCause();
        }
    }
    return throwable.getMessage();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:MessageContextBuilder.java

示例12: doInvoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public InvocationResponse doInvoke(MessageContext msgContext) throws AxisFault {
    SOAPHeader header = msgContext.getEnvelope().getHeader();
    if(configuration == null){
    	AxisConfiguration conf = msgContext.getConfigurationContext().getAxisConfiguration();
    	rolePlayer = (RolePlayer)conf.getParameterValue(Constants.SOAP_ROLE_PLAYER_PARAMETER);
    	configuration = conf;
    }
    
    // check whether another handler has explicitly set which addressing namespace to expect.
    Iterator iterator = null;
    String namespace = (String) msgContext.getProperty(WS_ADDRESSING_VERSION);
    
    // check whether the service is configured to use a particular version of WS-Addressing,
    // e.g. via JAX-WS annotations.
    if (namespace == null) {
        Parameter namespaceParam = msgContext.getParameter(WS_ADDRESSING_VERSION);
        namespace = Utils.getParameterValue(namespaceParam);
    }
    
    if (namespace == null) {
        namespace = Final.WSA_NAMESPACE;
        iterator = header.getHeadersToProcess(rolePlayer, namespace);

        if (!iterator.hasNext()) {
            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                log.debug("No headers present corresponding to " + namespace);
            }

            namespace = Submission.WSA_NAMESPACE;
            iterator = header.getHeadersToProcess(rolePlayer, namespace);
        }
    }
    else if (Final.WSA_NAMESPACE.equals(namespace) || Submission.WSA_NAMESPACE.equals(namespace)) {
        iterator = header.getHeadersToProcess(rolePlayer, namespace);
        
        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
            log.debug("The preconfigured namespace is, , " + namespace);
        }            
    }
    else {
        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
            log.debug("The specified namespace is not supported by this handler, " + namespace);
        }            

        return InvocationResponse.CONTINUE;
    }

    if (iterator.hasNext()) {
        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
            log.debug(namespace +
                      " headers present in the SOAP message. Starting to process ...");
        }

        //Need to set these properties here, before we extract the WS-Addressing
        //information, in case we throw a fault.
        msgContext.setProperty(WS_ADDRESSING_VERSION, namespace);
        msgContext.setProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.FALSE);
        
        extractAddressingInformation(msgContext, iterator, namespace);
        
        // check for reference parameters
        if (!disableRefparamExtract) {
            extractToEprReferenceParameters(msgContext.getTo(), header, namespace);
        }
        
        //We should only get to this point if we haven't thrown a fault.
        msgContext.setProperty(IS_ADDR_INFO_ALREADY_PROCESSED, Boolean.TRUE);
    }
    else {
        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
            log.debug("No headers present corresponding to " + namespace);
        }
    }

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

示例13: _isHighFidelity

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
 * isHighFidelity
 * 
 * The JAX-WS engine attempts to stream data as fast as possible.
 * For example, the message payload may be transformed into a JAXB object early in the processing.
 * Unfortunately such transformations are lossy, some information is lost.
 * An installed SOAP handler will see different namespaces (etc) then the original message.
 * 
 * If the a customer enables the "jaxws.payload.highFidelity" flag, then lossy transformations are
 * avoided until necessary.  
 * 
 * @see Constants.JAXWS_HIGH_FIDELITY
 * 
 * @param mc
 * @return true if high fidelity is requested
 */
private static boolean _isHighFidelity(MessageContext mc) {
    
    boolean value = false;
    if (mc == null) {
        if (log.isDebugEnabled()) {
            log.debug("_isHighFidelity returns false due to missing MessageContext");
        }
        return false;
    }
    
    // First examine the high fidelity flag on the context hierarchy
    Boolean highFidelity = (Boolean) mc.getProperty(
            org.apache.axis2.jaxws.Constants.JAXWS_PAYLOAD_HIGH_FIDELITY);
    if (highFidelity != null) {
        value = highFidelity.booleanValue();
        if (log.isDebugEnabled()) {
            log.debug("_isHighFidelity returns " + value + " per Context property " + 
                    org.apache.axis2.jaxws.Constants.JAXWS_PAYLOAD_HIGH_FIDELITY);
        }
        return value;
    }
    
    // Second examine the deprecated jaxb streaming flag
    Boolean jaxbStreaming = (Boolean) mc.getProperty(
            org.apache.axis2.jaxws.Constants.JAXWS_ENABLE_JAXB_PAYLOAD_STREAMING);
    if (jaxbStreaming != null) {
        value = !jaxbStreaming.booleanValue();
        if (log.isDebugEnabled()) {
            log.debug("_isHighFidelity returns " + value + " per inspection of Context property " + 
                    org.apache.axis2.jaxws.Constants.JAXWS_ENABLE_JAXB_PAYLOAD_STREAMING);
        }
        return value;
    }
    
    // Now look at the high fidelity parameter
    Parameter p = mc.getParameter(org.apache.axis2.jaxws.Constants.JAXWS_PAYLOAD_HIGH_FIDELITY);
    if (p != null) {
        value = JavaUtils.isTrue(p.getValue());
        if (log.isDebugEnabled()) {
            log.debug("_isHighFidelity returns " + value + " per inspection of Configuration property " + 
                    org.apache.axis2.jaxws.Constants.JAXWS_PAYLOAD_HIGH_FIDELITY);
        }
        return value;
    }
    
    if (log.isDebugEnabled()) {
        log.debug("_isHighFidelity returns the default: false");
    }
    return false;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:67,代码来源:HandlerUtils.java

示例14: initializeMessageContext

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public static int initializeMessageContext(MessageContext msgContext,
                                            String soapActionHeader,
                                            String requestURI,
                                            String contentType) {
    int soapVersion = VERSION_UNKNOWN;
    // remove the starting and trailing " from the SOAP Action
    if ((soapActionHeader != null) 
            && soapActionHeader.length() > 0 
            && soapActionHeader.charAt(0) == '\"'
            && soapActionHeader.endsWith("\"")) {
        soapActionHeader = soapActionHeader.substring(1, soapActionHeader.length() - 1);
    }

    // fill up the Message Contexts
    msgContext.setSoapAction(soapActionHeader);
    msgContext.setTo(new EndpointReference(requestURI));
    msgContext.setServerSide(true);

    // get the type of char encoding
    String charSetEnc = BuilderUtil.getCharSetEncoding(contentType);
    if (charSetEnc == null) {
        charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
    }
    msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);

    if (contentType != null) {
        if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) {
            soapVersion = VERSION_SOAP12;
            TransportUtils.processContentTypeForAction(contentType, msgContext);
        } else if (contentType
                .indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) > -1) {
            soapVersion = VERSION_SOAP11;
        } else if (isRESTRequest(contentType)) {
            // If REST, construct a SOAP11 envelope to hold the rest message and
            // indicate that this is a REST message.
            soapVersion = VERSION_SOAP11;
            msgContext.setDoingREST(true);
        }
        if (soapVersion == VERSION_SOAP11) {
            // TODO Keith : Do we need this anymore
            // Deployment configuration parameter
        	Parameter disableREST = msgContext
                    .getParameter(Constants.Configuration.DISABLE_REST);
        	if (soapActionHeader == null && disableREST != null) {
        		if (Constants.VALUE_FALSE.equals(disableREST.getValue())) {
                    // If the content Type is text/xml (BTW which is the
                    // SOAP 1.1 Content type ) and the SOAP Action is
                    // absent it is rest !!
                    msgContext.setDoingREST(true);
                }
            }
        }
    }
    return soapVersion;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:56,代码来源:HTTPTransportUtils.java

示例15: receive

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
   *
   * @param messageCtx active MessageContext
   * @throws AxisFault if a problem occurred
   */
  public void receive(final MessageContext messageCtx) throws AxisFault {
  	if (messageCtx.isPropertyTrue(DO_ASYNC)
		|| ((messageCtx.getParameter(DO_ASYNC) != null) &&
                  JavaUtils.isTrueExplicitly(messageCtx.getParameter(DO_ASYNC).getValue()))) {

          String mep = messageCtx.getAxisOperation()
			.getMessageExchangePattern();
	EndpointReference replyTo = messageCtx.getReplyTo();
	// In order to invoke the service in the ASYNC mode, the request
	// should contain ReplyTo header if the MEP of the service is not
	// InOnly type
	if ((!WSDLUtil.isOutputPresentForMEP(mep))
			|| (replyTo != null && !replyTo.hasAnonymousAddress())) {
		AsyncMessageReceiverWorker worker = new AsyncMessageReceiverWorker(
				messageCtx);
		messageCtx.getEnvelope().build();
		messageCtx.getConfigurationContext().getThreadPool().execute(
				worker);
		return;
	}
}


      ThreadContextDescriptor tc = setThreadContext(messageCtx);
      try {
          invokeBusinessLogic(messageCtx);
      } catch (AxisFault fault) {
          // signal the transport to rollback the tx, if any
          messageCtx.setProperty(Constants.SET_ROLLBACK_ONLY, true);
          // If we're in-only, eat this.  Otherwise, toss it upwards!
          if ((messageCtx.getAxisOperation() instanceof InOnlyAxisOperation) &&
                  !WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(messageCtx.getAxisOperation().getMessageExchangePattern())) {
              log.error(fault);
          } else {
              fault.setFaultType(Constants.APPLICATION_FAULT);
              throw fault;
          }
      } finally {
          restoreThreadContext(tc);
      }
  }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:47,代码来源:AbstractMessageReceiver.java


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