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


Java Message.getContextualProperty方法代码示例

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


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

示例1: createContext

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
@Override
public ServiceContext createContext(Message message) {
	ServiceContext serviceContext = null;

	// get the current HttpServletRequest for building the service context
	// instance.
	HttpServletRequest request = (HttpServletRequest) message.getContextualProperty(PROPKEY_HTTP_REQUEST);

	try {
		// now we can create a service context
		serviceContext = ServiceContextFactory.getInstance(request);

		// done!
	} catch (PortalException e) {
		_log.warn("Failed creating service context: " + e.getMessage(), e);
	}

	// return the new instance.
	return serviceContext;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:21,代码来源:ServiceContextProvider.java

示例2: createContext

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
/**
 * Returns the {@link Connection} for the given {@link Message} and saves it as a
 * contextual property.
 * If a {@link Connection} was already opened for the given {@link Message} than
 * the already opened one will returned.
 */
@Override
public Connection createContext(final Message message) {
	Connection con = (Connection) message.getContextualProperty(PROPERTY_CONNECTION);

	if(con == null) {
		con = DBConnectionProvider.getInstance().acquire();
		message.setContextualProperty(PROPERTY_CONNECTION, con);
	}

	return con;
}
 
开发者ID:XMBomb,项目名称:InComb,代码行数:18,代码来源:DBConnectionContextProvider.java

示例3: shouldBuffer

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
protected boolean shouldBuffer(Message message) {
    Object en = message.getContextualProperty(OUT_BUFFERING);
    boolean allowBuffer = true;
    boolean buffer = false;
    if (en != null) {
        buffer = Boolean.TRUE.equals(en) || "true".equals(en);
        allowBuffer = !(Boolean.FALSE.equals(en) || "false".equals(en));
    }
    // need to cache the events in case validation fails or buffering is enabled
    return buffer || (allowBuffer && shouldValidate(message) && !isRequestor(message));
}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:12,代码来源:AbstractOutDatabindingInterceptor.java

示例4: shouldValidate

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
protected boolean shouldValidate(Message m) {
	// add by jirunfang  ---start
    boolean result = ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, m);
    Object validateRes = m.getContextualProperty("schema-validation-response-enabled");
    String str = validateRes != null ? validateRes.toString() : "";
    // add by jirunfang  ---end
    
    return !"false".equalsIgnoreCase(str) && result;
}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:10,代码来源:AbstractOutDatabindingInterceptor.java

示例5: setupConnection

import org.apache.cxf.message.Message; //导入方法依赖的package包/类
protected void setupConnection(Message message, Address address, HTTPClientPolicy csPolicy) throws IOException {
    HttpURLConnection connection = createConnection(message, address, csPolicy);
    // --add by jirunfang start
    CookieHandler.setDefault(null);
    // --add by jirunfang end
    connection.setDoOutput(true);       
    
    int ctimeout = determineConnectionTimeout(message, csPolicy);
    connection.setConnectTimeout(ctimeout);
    
    int rtimeout = determineReceiveTimeout(message, csPolicy);
    connection.setReadTimeout(rtimeout);
    
    connection.setUseCaches(false);
    // We implement redirects in this conduit. We do not
    // rely on the underlying URLConnection implementation
    // because of trust issues.
    connection.setInstanceFollowRedirects(false);

    // If the HTTP_REQUEST_METHOD is not set, the default is "POST".
    String httpRequestMethod = 
        (String)message.get(Message.HTTP_REQUEST_METHOD);
    if (httpRequestMethod == null) {
        httpRequestMethod = "POST";
        message.put(Message.HTTP_REQUEST_METHOD, "POST");
    }
    try {
        connection.setRequestMethod(httpRequestMethod);
    } catch (java.net.ProtocolException ex) {
        Object o = message.getContextualProperty(HTTPURL_CONNECTION_METHOD_REFLECTION);
        boolean b = DEFAULT_USE_REFLECTION;
        if (o != null) {
            b = MessageUtils.isTrue(o);
        }
        if (b) {
            try {
                java.lang.reflect.Field f = ReflectionUtil.getDeclaredField(HttpURLConnection.class, "method");
                ReflectionUtil.setAccessible(f).set(connection, httpRequestMethod);
                message.put(HTTPURL_CONNECTION_METHOD_REFLECTION, true);
            } catch (Throwable t) {
                t.printStackTrace();
                throw ex;
            }
        } else {
            throw ex;
        }
    }
    
    // We place the connection on the message to pick it up
    // in the WrappedOutputStream.
    message.put(KEY_HTTP_CONNECTION, connection);
    message.put(KEY_HTTP_CONNECTION_ADDRESS, address);
}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:54,代码来源:URLConnectionHTTPConduit.java


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