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


Java HTTPClientPolicy.setReceiveTimeout方法代码示例

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


在下文中一共展示了HTTPClientPolicy.setReceiveTimeout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:equella,项目名称:Equella,代码行数:22,代码来源:SoapClientFactory.java

示例2: 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;
}
 
开发者ID:equella,项目名称:Equella,代码行数:25,代码来源:SoapHelper.java

示例3: test

import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
@GET
@Path("test")
public String test() {

    TestService_Service s = new TestService_Service();
    TestService ts = s.getTestServicePort();

    // 设置客户端的配置信息,超时等.
    Client proxy = ClientProxy.getClient(ts);
    HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
    HTTPClientPolicy policy = new HTTPClientPolicy();

    // 连接服务器超时时间
    policy.setConnectionTimeout(30000);
    // 等待服务器响应超时时间
    policy.setReceiveTimeout(30000);

    conduit.setClient(policy);

    ts.echo();
    return "web service perfect";
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:23,代码来源:WSService.java

示例4: 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;
	}
 
开发者ID:fpompermaier,项目名称:onvif,代码行数:26,代码来源:OnvifDevice.java

示例5: start

import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
public T start(Class<T> cls, String url, boolean trustAllCerts, String trustStore, String trustStorePassword, 
	List<?> providers, int connectTimeout, int receiveTimeout) {

	try {
		
		T resource = JAXRSClientFactory.create(url, cls, providers);
	    HTTPConduit conduit = WebClient.getConfig(resource).getHttpConduit();
	    WebClient.getConfig(resource).getInInterceptors().add(new LoggingInInterceptor());
	    WebClient.getConfig(resource).getOutInterceptors().add(new LoggingOutInterceptor());
		configureHTTPS(resource, conduit, trustAllCerts, trustStore, trustStorePassword);
		
	    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); 
	    httpClientPolicy.setConnectionTimeout(connectTimeout); 
	    httpClientPolicy.setReceiveTimeout(receiveTimeout); 
	    conduit.setClient(httpClientPolicy);
		
		return resource;
		
	} catch (Exception e) {
		LOG.error(" rest client '{}': NOT STARTED", url);
		return null;
	}
	
}
 
开发者ID:csob,项目名称:paymentgateway,代码行数:25,代码来源:JaxRsClientStarter.java

示例6: build

import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
/**
 * Build a client proxy, for a specific proxy type.
 * 
 * @param proxyType proxy type class
 * @return client proxy stub
 */
protected <T> T build(Class<T> proxyType) {
    String address = generateAddress();
    T rootResource;
    // Synchronized on the class to correlate with the scope of clientStaticResources
    // We want to ensure that the shared bean isn't set concurrently in multiple callers
    synchronized (AmbariClientBuilder.class) {
        JAXRSClientFactoryBean bean = cleanFactory(clientStaticResources.getUnchecked(proxyType));
        bean.setAddress(address);
        if (username != null) {
            bean.setUsername(username);
            bean.setPassword(password);
        }

        if (enableLogging) {
            bean.setFeatures(Arrays.<AbstractFeature> asList(new LoggingFeature()));
        }
        rootResource = bean.create(proxyType);
    }

    boolean isTlsEnabled = address.startsWith("https://");
    ClientConfiguration config = WebClient.getConfig(rootResource);
    HTTPConduit conduit = (HTTPConduit) config.getConduit();
    if (isTlsEnabled) {
        TLSClientParameters tlsParams = new TLSClientParameters();
        if (!validateCerts) {
            tlsParams.setTrustManagers(new TrustManager[] { new AcceptAllTrustManager() });
        } else if (trustManagers != null) {
            tlsParams.setTrustManagers(trustManagers);
        }
        tlsParams.setDisableCNCheck(!validateCn);
        conduit.setTlsClientParameters(tlsParams);
    }

    HTTPClientPolicy policy = conduit.getClient();
    policy.setConnectionTimeout(connectionTimeoutUnits.toMillis(connectionTimeout));
    policy.setReceiveTimeout(receiveTimeoutUnits.toMillis(receiveTimeout));
    return rootResource;
}
 
开发者ID:Talend,项目名称:components,代码行数:45,代码来源:AmbariClientBuilder.java

示例7: creatClient

import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
public AccountSoapService creatClient() {
	String address = baseUrl + "/cxf/soap/accountservice";

	JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
	proxyFactory.setAddress(address);
	proxyFactory.setServiceClass(AccountSoapService.class);
	AccountSoapService accountWebServiceProxy = (AccountSoapService) proxyFactory.create();

	//(可选)演示重新设定endpoint address.
	((BindingProvider) accountWebServiceProxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
			address);

	//(可选)演示重新设定Timeout时间
	Client client = ClientProxy.getClient(accountWebServiceProxy);
	HTTPConduit conduit = (HTTPConduit) client.getConduit();
	HTTPClientPolicy policy = conduit.getClient();
	policy.setReceiveTimeout(600000);

	return accountWebServiceProxy;
}
 
开发者ID:Michaelleolee,项目名称:appengine,代码行数:21,代码来源:AccountWebServiceWithDynamicCreateClientFT.java

示例8: 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);
	}
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:20,代码来源:SoapClientFactory.java

示例9: 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()));
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:38,代码来源:EquellaRepoServiceImpl.java

示例10: doRefer

import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
  protected <T> T doRefer(final Class<T> serviceType, final URL url) throws RpcException {
  	ClientProxyFactoryBean proxyFactoryBean = new ClientProxyFactoryBean();
  	proxyFactoryBean.setAddress(url.setProtocol("http").toIdentityString());
  	proxyFactoryBean.setServiceClass(serviceType);
  	proxyFactoryBean.setBus(bus);
  	T ref = (T) proxyFactoryBean.create();
  	Client proxy = ClientProxy.getClient(ref);  
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setConnectionTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
policy.setReceiveTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
conduit.setClient(policy);
      return ref;
  }
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:16,代码来源:WebServiceProtocol.java

示例11: configHttpConduit

import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
private void configHttpConduit(Object port) {

        // 设置客户端的配置信息,超时等.
        Client proxy = ClientProxy.getClient(port);
        HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
        HTTPClientPolicy policy = new HTTPClientPolicy();

        // 连接服务器超时时间
        policy.setConnectionTimeout(this.connectTimeout);
        // 等待服务器响应超时时间
        policy.setReceiveTimeout(this.receiveTimeout);

        conduit.setClient(policy);
    }
 
开发者ID:uavorg,项目名称:uavstack,代码行数:15,代码来源:CECXFClient.java

示例12: createWebClient

import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; //导入方法依赖的package包/类
/**
 * Creates a JAXRS web client for the given JAXRS client
 */
protected <T> T createWebClient(Class<T> clientType) {
    List<Object> providers = WebClients.createProviders();
    String queryString = "?secret=" + secret + "&secretNamespace=" + secretNamespace + "&kubeUserName=" + kubeUserName;
    String commandsAddress = URLUtils.pathJoin(this.address, "/api/forge" + queryString);
    WebClient webClient = WebClient.create(commandsAddress, providers);
    disableSslChecks(webClient);
    HTTPConduit conduit = WebClient.getConfig(webClient).getHttpConduit();
    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setConnectionTimeout(connectionTimeoutMillis);
    httpClientPolicy.setReceiveTimeout(connectionTimeoutMillis);
    conduit.setClient(httpClientPolicy);

    return JAXRSClientFactory.fromClient(webClient, clientType);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:18,代码来源:ForgeClient.java

示例13: 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);
       }
       // Envi­o chunked
	httpClientPolicy.setAllowChunking(isWsClientChunked());
       httpConduit.setClient(httpClientPolicy);
       
	if (disableCnCheck) {
        TLSClientParameters tlsParams = new TLSClientParameters();
        tlsParams.setDisableCNCheck(true);
        httpConduit.setTlsClientParameters(tlsParams);
	}
	return c;
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:59,代码来源:WsClientUtils.java

示例14: 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);
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:11,代码来源:CxfClientUtilsOld.java

示例15: 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);
}
 
开发者ID:Huawei,项目名称:eSDK_IVS_Java,代码行数:9,代码来源:ClientProvider.java


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