本文整理汇总了Java中com.sun.jersey.client.urlconnection.HttpURLConnectionFactory类的典型用法代码示例。如果您正苦于以下问题:Java HttpURLConnectionFactory类的具体用法?Java HttpURLConnectionFactory怎么用?Java HttpURLConnectionFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpURLConnectionFactory类属于com.sun.jersey.client.urlconnection包,在下文中一共展示了HttpURLConnectionFactory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHttpClient
import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory; //导入依赖的package包/类
@Override
public Client getHttpClient() {
ClientConfig config = new DefaultClientConfig(JSONRootElementProvider.App.class);
HttpURLConnectionFactory urlFactory = new PseudoAuthenticatedURLConnectionFactory(connectionConf);
Client httpClient = new Client(new URLConnectionClientHandler(urlFactory), config);
return httpClient;
}
示例2: getHttpClient
import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory; //导入依赖的package包/类
private Client getHttpClient() {
if (httpClient == null) {
ClientConfig config = new DefaultClientConfig(JSONRootElementProvider.App.class);
HttpURLConnectionFactory urlFactory = new PseudoAuthenticatedURLConnectionFactory();
return new Client(new URLConnectionClientHandler(urlFactory), config);
}
return httpClient;
}