本文整理汇总了Java中org.apache.cxf.transports.http.configuration.HTTPClientPolicy.setAllowChunking方法的典型用法代码示例。如果您正苦于以下问题:Java HTTPClientPolicy.setAllowChunking方法的具体用法?Java HTTPClientPolicy.setAllowChunking怎么用?Java HTTPClientPolicy.setAllowChunking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.transports.http.configuration.HTTPClientPolicy
的用法示例。
在下文中一共展示了HTTPClientPolicy.setAllowChunking方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSoapClient
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
public <T> T createSoapClient(Class<T> serviceClass, URL endpoint, String namespace)
{
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
Bus bus = new ExtensionManagerBus(null, null, Bus.class.getClassLoader());
factory.setBus(bus);
factory.setServiceClass(serviceClass);
factory.setServiceName(new QName(namespace, serviceClass.getSimpleName()));
factory.setAddress(endpoint.toString());
factory.getServiceFactory().getServiceConfigurations().add(0, new XFireCompatabilityConfiguration());
factory.setDataBinding(new AegisDatabinding());
@SuppressWarnings("unchecked")
T soapClient = (T) factory.create();
Client client = ClientProxy.getClient(soapClient);
client.getRequestContext().put(Message.MAINTAIN_SESSION, true);
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(600000);
policy.setAllowChunking(false);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
conduit.setClient(policy);
return soapClient;
}
示例2: getServiceProxy
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
public static JaxWsProxyFactoryBean getServiceProxy(BindingProvider servicePort, String serviceAddr) {
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
if(serviceAddr != null)
proxyFactory.setAddress(serviceAddr);
proxyFactory.setServiceClass(servicePort.getClass());
proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
SoapBindingConfiguration config = new SoapBindingConfiguration();
config.setVersion(Soap12.getInstance());
proxyFactory.setBindingConfig(config);
Client deviceClient = ClientProxy.getClient(servicePort);
HTTPConduit http = (HTTPConduit) deviceClient.getConduit();
// AuthorizationPolicy authPolicy = new AuthorizationPolicy();
// authPolicy.setUserName(username);
// authPolicy.setPassword(password);
// authPolicy.setAuthorizationType("Basic");
// http.setAuthorization(authPolicy);
HTTPClientPolicy httpClientPolicy = http.getClient();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setReceiveTimeout(32000);
httpClientPolicy.setAllowChunking(false);
return proxyFactory;
}
示例3: createSoap
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T> T createSoap(Class<T> serviceClass, URL endpoint, String namespace, Object previousSession)
{
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setServiceClass(serviceClass);
factory.setServiceName(new QName(namespace, serviceClass.getSimpleName()));
factory.setAddress(endpoint.toString());
List<AbstractServiceConfiguration> configs = factory.getServiceFactory().getServiceConfigurations();
configs.add(0, new XFireReturnTypeConfig());
factory.setDataBinding(new AegisDatabinding());
T service = (T) factory.create();
Client client = ClientProxy.getClient(service);
client.getRequestContext().put(Message.MAINTAIN_SESSION, true);
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(600000);
policy.setAllowChunking(false);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
conduit.setClient(policy);
if( previousSession != null )
{
copyCookiesInt(conduit, previousSession);
}
return service;
}
示例4: configureBean
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
@Override
public void configureBean(String name, Object beanInstance) {
if (beanInstance instanceof HTTPConduit) {
HTTPConduit http = (HTTPConduit) beanInstance;
TLSClientParameters tls = new TLSClientParameters();
tls.setTrustManagers(trustManagers);
tls.setKeyManagers(keyManagers);
tls.setDisableCNCheck(true);
tls.setCipherSuitesFilter(getCipherSuites());
http.setTlsClientParameters(tls);
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(36000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(120000);
http.setClient(httpClientPolicy);
} else {
parentConfigurer.configureBean(name, beanInstance);
}
}
示例5: getNewClient
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
protected SoapHarvesterService getNewClient(String url, String sharedId, String sharedValue, String username)
{
try
{
final URL endpointUrl = new URL(new URL(url), HARVESTER_ENDPOINT);
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
Bus bus = new ExtensionManagerBus(null, null, Bus.class.getClassLoader());
factory.setBus(bus);
factory.setServiceClass(SoapHarvesterService.class);
factory.setServiceName(
new QName("http://soap.harvester.core.tle.com", SoapHarvesterService.class.getSimpleName()));
factory.setAddress(endpointUrl.toString());
factory.setDataBinding(new AegisDatabinding());
List<AbstractServiceConfiguration> configs = factory.getServiceFactory().getServiceConfigurations();
configs.add(0, new XFireReturnTypeConfig());
SoapHarvesterService soapClient = (SoapHarvesterService) factory.create();
Client client = ClientProxy.getClient(soapClient);
client.getRequestContext().put(Message.MAINTAIN_SESSION, true);
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(600000);
policy.setAllowChunking(false);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
// Works?
// conduit.getTlsClientParameters().setSSLSocketFactory(BlindSSLSocketFactory.getDefaultSSL());
conduit.setClient(policy);
soapClient.loginWithToken(TokenGenerator.createSecureToken(username, sharedId, sharedValue, null));
return soapClient;
}
catch( Exception x )
{
LOGGER.error("Error connecting to remote EQUELLA server", x);
throw new RuntimeException(
CurrentLocale.get("com.tle.core.remoterepo.equella.error.communication", x.getMessage()));
}
}
示例6: getWsClientProxy
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
public static Object getWsClientProxy(
Class<?> clientClass,
String wsUrl,
String wsUserName,
String wsPassword,
String authType,
boolean generateTimestamp,
boolean logCalls,
boolean disableCnCheck,
Integer timeout) {
ClientProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress(wsUrl);
factory.setServiceClass(clientClass);
if (logCalls) {
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
}
String authTypeBo = authType;
if (authTypeBo == null || authTypeBo.length() == 0) {
if (wsUserName != null && wsUserName.length() > 0)
authTypeBo = "BASIC";
}
if ("BASIC".equalsIgnoreCase(authTypeBo)) {
factory.setUsername(wsUserName);
factory.setPassword(wsPassword);
} else if ("USERNAMETOKEN".equalsIgnoreCase(authTypeBo)) {
Map<String, Object> wss4jInterceptorProps = new HashMap<String, Object>();
if (generateTimestamp) {
wss4jInterceptorProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP + " " + WSHandlerConstants.USERNAME_TOKEN);
} else {
wss4jInterceptorProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
}
wss4jInterceptorProps.put(WSHandlerConstants.USER, wsUserName);
wss4jInterceptorProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
ClientPasswordCallback cp = new ClientPasswordCallback(wsPassword);
wss4jInterceptorProps.put(WSHandlerConstants.PW_CALLBACK_REF, cp);
factory.getOutInterceptors().add(new WSS4JOutInterceptor(wss4jInterceptorProps));
}
Object c = factory.create();
Client client = ClientProxy.getClient(c);
HTTPConduit httpConduit = (HTTPConduit)client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
if (timeout != null) {
httpClientPolicy.setConnectionTimeout(timeout);
httpClientPolicy.setReceiveTimeout(timeout);
}
// Envio chunked
httpClientPolicy.setAllowChunking(isWsClientChunked());
httpConduit.setClient(httpClientPolicy);
if (disableCnCheck) {
TLSClientParameters tlsParams = new TLSClientParameters();
tlsParams.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsParams);
}
return c;
}
示例7: configureTimeout
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
private static void configureTimeout(HTTPConduit httpConduit)
{
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(connectionTimeout);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(receiveTimeout);
httpConduit.setClient(httpClientPolicy);
}
示例8: configHttpClientPolicy
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
private static void configHttpClientPolicy(HTTPConduit http)
{
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(60000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(60000);
http.setClient(httpClientPolicy);
}
示例9: configHttpClientPolicy
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
private static void configHttpClientPolicy(HTTPConduit http) {
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(60000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(60000);
http.setClient(httpClientPolicy);
}
示例10: defaultClientPolicy
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
private static HTTPClientPolicy defaultClientPolicy() {
final HTTPClientPolicy client = new HTTPClientPolicy();
client.setConnection(ConnectionType.CLOSE);
client.setAllowChunking(false);
client.setConnectionTimeout(0);
client.setReceiveTimeout(0);
return client;
}
示例11: createService
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
private <T> T createService(final Class<T> clazz,
final QName service,
final QName portName,
final String address,
final String userName,
final String password,
final String connectionTimeout,
final String readTimeout) {
Preconditions.checkNotNull(service, "service");
Preconditions.checkNotNull(portName, "portName");
Preconditions.checkNotNull(address, "address");
Preconditions.checkNotNull(userName, "username");
Preconditions.checkNotNull(password, "password");
// Delegate logging to slf4j (see also https://github.com/killbill/killbill-platform/tree/master/osgi-bundles/libs/slf4j-osgi)
LogUtils.setLoggerClass(Slf4jLogger.class);
final Service result = Service.create(null, service);
result.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, address);
final T port = result.getPort(portName, clazz);
final Client client = ClientProxy.getClient(port);
client.getEndpoint().put("jaxb-validation-event-handler", new IgnoreUnexpectedElementsEventHandler());
final HTTPConduit conduit = (HTTPConduit) client.getConduit();
final HTTPClientPolicy clientPolicy = conduit.getClient();
clientPolicy.setAllowChunking(config.getAllowChunking());
if (config.getTrustAllCertificates()) {
final TLSClientParameters tcp = new TLSClientParameters();
tcp.setTrustManagers(new TrustManager[]{new TrustAllX509TrustManager()});
conduit.setTlsClientParameters(tcp);
}
if (connectionTimeout != null) {
clientPolicy.setConnectionTimeout(Long.valueOf(connectionTimeout));
}
if (readTimeout != null) {
clientPolicy.setReceiveTimeout(Long.valueOf(readTimeout));
}
if (config.getProxyServer() != null) {
clientPolicy.setProxyServer(config.getProxyServer());
}
if (config.getProxyPort() != null) {
clientPolicy.setProxyServerPort(config.getProxyPort());
}
if (config.getProxyType() != null) {
clientPolicy.setProxyServerType(ProxyServerType.fromValue(config.getProxyType().toUpperCase()));
}
((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, userName);
((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
final Endpoint endpoint = client.getEndpoint();
endpoint.getInInterceptors().add(loggingInInterceptor);
endpoint.getOutInterceptors().add(loggingOutInterceptor);
endpoint.getOutInterceptors().add(httpHeaderInterceptor);
return port;
}
示例12: getClient
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
@SuppressWarnings(
{ "rawtypes", "unchecked" })
public static synchronized Object getClient(Class clz)
{
Object clientObj = clientMap.get(clz.getName());
if (null != clientObj)
{
return clientObj;
}
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
String url = PropertiesUtils.getValue("sdkserver.url");
String serviceUrl = "";
if (clz.getName().equals(TPCommon.class.getName()))
{
serviceUrl = PropertiesUtils.getValue("professional.common.service.url");
}
else if (clz.getName().equals(TPProfessionalConfMgr.class.getName()))
{
serviceUrl = PropertiesUtils.getValue("professional.confMgr.service.url");
}
else if (clz.getName().equals(TPProfessionalConfCtr.class.getName()))
{
serviceUrl = PropertiesUtils.getValue("professional.confCtr.service.url");
}
else if (clz.getName().equals(TPProfessionalSiteMgr.class.getName()))
{
serviceUrl = PropertiesUtils.getValue("professional.siteMgr.service.url");
}
factory.setAddress(url + "/" + serviceUrl);
Object service = null;
service = factory.create(clz);
Client client = ClientProxy.getClient(service);
// Add the header info
// client.getRequestContext().put(Header.HEADER_LIST, prepareHeaders());
if(Boolean.valueOf(PropertiesUtils.getValue("logging")))
{
client.getOutInterceptors().add(new LoggingOutInterceptor());
client.getInInterceptors().add(new LoggingInInterceptor());
}
// 做拦截器,对发送出去的消息添加sessionID,对收到的消息截取sessionID
client.getOutInterceptors().add(new MsgOutInterceptor());
client.getInInterceptors().add(new MsgInInterceptor());
// Setting HTTP Related information
HTTPConduit http = (HTTPConduit) client.getConduit();
if (null == http) {
return null;
}
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(35000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(30000);
http.setClient(httpClientPolicy);
clientMap.put(clz.getName(), service);
return service;
}
示例13: configHttpClientPolicy
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
private static void configHttpClientPolicy(HTTPConduit http, ClientProviderBean bean)
{
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(bean.getConnectionTimeout());
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(bean.getReceiveTimeout());
http.setClient(httpClientPolicy);
}