• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ApacheHttpClient4Handler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JedisMonitor类代码示例发布时间:2022-05-22
下一篇:
Java OAuth2ClientProperties类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap