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


Java MessageContext.isPropertyTrue方法代码示例

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


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

示例1: shouldInvoke

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public boolean shouldInvoke(MessageContext msgContext) throws AxisFault {
    Parameter param = null;
    boolean disableAddressing = false;
    
    Object o = msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
    if (o == null || !(o instanceof Boolean)) {
        //determine whether outbound addressing has been disabled or not.
        // Get default value from module.xml or axis2.xml files
        param = msgContext.getModuleParameter(DISABLE_ADDRESSING_FOR_OUT_MESSAGES, MODULE_NAME, handlerDesc);
        disableAddressing =
            msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
                JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));
    } else {
        disableAddressing = (Boolean) o;
    }

    if (disableAddressing) {
        if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
            log.trace(msgContext.getLogIDString() +
                    " Addressing is disabled. Not adding WS-Addressing headers.");
        }
        return false;
    }
    return true;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:AddressingOutHandler.java

示例2: executeMethod

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
protected void executeMethod(HttpClient httpClient, MessageContext msgContext, URL url,
                             HttpMethod method) throws IOException {
    HostConfiguration config = this.getHostConfiguration(httpClient, msgContext, url);

    // set the custom headers, if available
    addCustomHeaders(method, msgContext);

    // add compression headers if needed
    if (msgContext.isPropertyTrue(HTTPConstants.MC_ACCEPT_GZIP)) {
        method.addRequestHeader(HTTPConstants.HEADER_ACCEPT_ENCODING,
                HTTPConstants.COMPRESSION_GZIP);
    }

    if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) {
        method.addRequestHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
                HTTPConstants.COMPRESSION_GZIP);
    }
    
    if (msgContext.getProperty(HTTPConstants.HTTP_METHOD_PARAMS) != null) {
        HttpMethodParams params = (HttpMethodParams)msgContext
                .getProperty(HTTPConstants.HTTP_METHOD_PARAMS);
        method.setParams(params);
    }

    String cookiePolicy = (String) msgContext.getProperty(HTTPConstants.COOKIE_POLICY);
    if (cookiePolicy != null) {
        method.getParams().setCookiePolicy(cookiePolicy);   
    }
    HttpState httpState = (HttpState)msgContext.getProperty(HTTPConstants.CACHED_HTTP_STATE);

    setTimeouts(msgContext, method);

    httpClient.executeMethod(config, method, httpState);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:35,代码来源:AbstractHTTPSender.java

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

示例4: doInvoke

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

    // Determine the addressin namespace in effect.
    Object addressingVersionFromCurrentMsgCtxt = msgContext.getProperty(WS_ADDRESSING_VERSION);
    if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
        log.trace("Addressing version string from messageContext=" +
                addressingVersionFromCurrentMsgCtxt);
    }
    boolean isSubmissionNamespace =
            Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt);

    // Determine whether to include optional addressing headers in the output.
    // Get default value from module.xml or axis2.xml files
    Parameter param = msgContext.getModuleParameter(
            INCLUDE_OPTIONAL_HEADERS, MODULE_NAME, handlerDesc);
    boolean includeOptionalHeaders =
        msgContext.isPropertyTrue(INCLUDE_OPTIONAL_HEADERS,
                JavaUtils.isTrueExplicitly(Utils.getParameterValue(param)));

    if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
        log.debug("includeOptionalHeaders=" + includeOptionalHeaders);
    }

    // Determine if a MustUnderstand attribute will be added to all headers in the
    // addressing namespace.
    boolean addMustUnderstandAttribute =
            msgContext.isPropertyTrue(ADD_MUST_UNDERSTAND_TO_ADDRESSING_HEADERS);

    // what if there are addressing headers already in the message. Do you replace that or not?
    // Lets have a parameter to control that. The default behavior is you won't replace addressing
    // headers if there are any (this was the case so far).
    boolean replaceHeaders = msgContext.isPropertyTrue(REPLACE_ADDRESSING_HEADERS);
    
    // Allow the user to specify the role these WS-Addressing headers should be targetted at.
    String role = (String) msgContext.getProperty(SOAP_ROLE_FOR_ADDRESSING_HEADERS);

    WSAHeaderWriter writer = new WSAHeaderWriter(msgContext, isSubmissionNamespace,
                                                 addMustUnderstandAttribute, replaceHeaders,
                                                 includeOptionalHeaders, role);
    writer.writeHeaders();

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

示例5: cleanup

import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private void cleanup(MessageContext msgContext, HttpMethod method) {
    if (msgContext.isPropertyTrue(HTTPConstants.AUTO_RELEASE_CONNECTION)) {
        log.trace("AutoReleasing " + method);
        method.releaseConnection();
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:7,代码来源:HTTPSender.java

示例6: 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.isPropertyTrue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。