本文整理汇总了Java中com.sun.jersey.client.apache4.ApacheHttpClient4Handler类的典型用法代码示例。如果您正苦于以下问题:Java ApacheHttpClient4Handler类的具体用法?Java ApacheHttpClient4Handler怎么用?Java ApacheHttpClient4Handler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApacheHttpClient4Handler类属于com.sun.jersey.client.apache4包,在下文中一共展示了ApacheHttpClient4Handler类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: newApiClient
import com.sun.jersey.client.apache4.ApacheHttpClient4Handler; //导入依赖的package包/类
/**
* @return a new jersey client using a multithreaded http client
*/
public WebResource newApiClient() {
ClientConfig cc = new DefaultClientConfig();
cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true);
cc.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, timeout);
cc.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, timeout);
cc.getClasses().add(JacksonJsonProvider.class);
// use custom configured object mapper ignoring unknown properties
cc.getClasses().add(ObjectMapperContextResolver.class);
HttpClient http = HttpUtil.newMultithreadedClient(timeout, maxConnections, maxConnections);
ApacheHttpClient4Handler hch = new ApacheHttpClient4Handler(http, null, false);
Client client = new ApacheHttpClient4(hch, cc);
LOG.info("Connecting to GBIF API: {}", url);
return client.resource(url);
}
开发者ID:gbif,项目名称:occurrence,代码行数:20,代码来源:ApiClientConfiguration.java
示例2: createDefaultJerseyClient
import com.sun.jersey.client.apache4.ApacheHttpClient4Handler; //导入依赖的package包/类
private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, MetricRegistry metricRegistry, String serviceName) {
HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
return new ApacheHttpClient4(handler, config);
}
开发者ID:bazaarvoice,项目名称:emodb,代码行数:8,代码来源:BlobStoreClientFactory.java
示例3: createDefaultJerseyClient
import com.sun.jersey.client.apache4.ApacheHttpClient4Handler; //导入依赖的package包/类
private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, String serviceName, MetricRegistry metricRegistry) {
HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
return new ApacheHttpClient4(handler, config);
}
开发者ID:bazaarvoice,项目名称:emodb,代码行数:8,代码来源:UserAccessControlClientFactory.java
示例4: createDefaultJerseyClient
import com.sun.jersey.client.apache4.ApacheHttpClient4Handler; //导入依赖的package包/类
private static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration) {
HttpClient httpClient = new HttpClientBuilder().using(configuration).build();
ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
// For shading reasons we can't add a Jackson JSON message body provider. However, our client implementation will
// handle wrapping all request and response entities using the shaded Jackson so this shouldn't matter.
return new ApacheHttpClient4(handler, config);
}
开发者ID:bazaarvoice,项目名称:emodb,代码行数:9,代码来源:BlobStoreClientFactory.java
示例5: createDefaultJerseyClient
import com.sun.jersey.client.apache4.ApacheHttpClient4Handler; //导入依赖的package包/类
static ApacheHttpClient4 createDefaultJerseyClient(HttpClientConfiguration configuration, String serviceName, MetricRegistry metricRegistry) {
HttpClient httpClient = new HttpClientBuilder(metricRegistry).using(configuration).build(serviceName);
ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(httpClient, null, true);
ApacheHttpClient4Config config = new DefaultApacheHttpClient4Config();
config.getSingletons().add(new JacksonMessageBodyProvider(Jackson.newObjectMapper(), _validatorFactory.getValidator()));
return new ApacheHttpClient4(handler, config);
}
开发者ID:bazaarvoice,项目名称:emodb,代码行数:8,代码来源:QueueClientFactory.java
示例6: WebServicesClient
import com.sun.jersey.client.apache4.ApacheHttpClient4Handler; //导入依赖的package包/类
public WebServicesClient(ClientConfig config)
{
if (SecurityUtils.isHadoopWebSecurityEnabled()) {
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
httpClientBuilder.setConnectionManager(connectionManager);
httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
httpClientBuilder.setDefaultAuthSchemeRegistry(authRegistry);
ApacheHttpClient4Handler httpClientHandler = new ApacheHttpClient4Handler(httpClientBuilder.build(), new BasicCookieStore(), false);
client = new Client(httpClientHandler, config);
} else {
client = Client.create(config);
}
}
开发者ID:apache,项目名称:apex-core,代码行数:14,代码来源:WebServicesClient.java
示例7: DownloadClient
import com.sun.jersey.client.apache4.ApacheHttpClient4Handler; //导入依赖的package包/类
public DownloadClient(HttpAutomationClient httpAutomationClient) {
ApacheHttpClient4Handler handler = new ApacheHttpClient4Handler(
httpAutomationClient.http(), new BasicCookieStore(), false);
client = new ApacheHttpClient4(handler);
if (httpAutomationClient.getRequestInterceptor() != null) {
client.addFilter(httpAutomationClient.getRequestInterceptor());
}
apiURL = httpAutomationClient.getBaseUrl();
}
开发者ID:tiry,项目名称:nuxeo-mule-connector,代码行数:12,代码来源:DownloadClient.java
示例8: buildClientHandler
import com.sun.jersey.client.apache4.ApacheHttpClient4Handler; //导入依赖的package包/类
private ApacheHttpClient4Handler buildClientHandler(HttpClient httpClient) {
return new ApacheHttpClient4Handler(httpClient, null, true);
}
开发者ID:BrettDuclos,项目名称:Dials,代码行数:4,代码来源:DialsClientBuilder.java
注:本文中的com.sun.jersey.client.apache4.ApacheHttpClient4Handler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论