本文整理汇总了Java中org.apache.http.client.protocol.RequestAuthCache类的典型用法代码示例。如果您正苦于以下问题:Java RequestAuthCache类的具体用法?Java RequestAuthCache怎么用?Java RequestAuthCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestAuthCache类属于org.apache.http.client.protocol包,在下文中一共展示了RequestAuthCache类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createHttpProcessor
import org.apache.http.client.protocol.RequestAuthCache; //导入依赖的package包/类
/**
* Create the processor with the following interceptors:
* <ul>
* <li>{@link RequestDefaultHeaders}</li>
* <li>{@link RequestContent}</li>
* <li>{@link RequestTargetHost}</li>
* <li>{@link RequestClientConnControl}</li>
* <li>{@link RequestUserAgent}</li>
* <li>{@link RequestExpectContinue}</li>
* <li>{@link RequestAddCookies}</li>
* <li>{@link ResponseProcessCookies}</li>
* <li>{@link RequestAuthCache}</li>
* <li>{@link RequestTargetAuthentication}</li>
* <li>{@link RequestProxyAuthentication}</li>
* </ul>
* <p>
* @return the processor with the added interceptors.
*/
@Override
protected BasicHttpProcessor createHttpProcessor() {
BasicHttpProcessor httpproc = new BasicHttpProcessor();
httpproc.addInterceptor(new RequestDefaultHeaders());
// Required protocol interceptors
httpproc.addInterceptor(new RequestContent());
httpproc.addInterceptor(new RequestTargetHost());
// Recommended protocol interceptors
httpproc.addInterceptor(new RequestClientConnControl());
httpproc.addInterceptor(new RequestUserAgent());
httpproc.addInterceptor(new RequestExpectContinue());
// HTTP state management interceptors
httpproc.addInterceptor(new RequestAddCookies());
httpproc.addInterceptor(new ResponseProcessCookies());
// HTTP authentication interceptors
httpproc.addInterceptor(new RequestAuthCache());
httpproc.addInterceptor(new RequestTargetAuthentication());
httpproc.addInterceptor(new RequestProxyAuthentication());
return httpproc;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:39,代码来源:DefaultHttpClient.java
示例2: _getApacheKissHttpClientBuilder
import org.apache.http.client.protocol.RequestAuthCache; //导入依赖的package包/类
private static HttpClientBuilder _getApacheKissHttpClientBuilder() {
return HttpClients.custom()
.addInterceptorFirst(new RequestDefaultHeaders())
.addInterceptorFirst(new RequestContent())
.addInterceptorFirst(new RequestTargetHost())
.addInterceptorFirst(new RequestClientConnControl())
.addInterceptorFirst(new RequestAddCookies())
.addInterceptorFirst(new ResponseProcessCookies())
.addInterceptorFirst(new RequestAuthCache())
.addInterceptorLast(new HttpRequestInterceptor() {
@Override
public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
if (request.containsHeader("User-Agent")) {
request.removeHeaders("User-Agent");
}
if (request.containsHeader("Custom-User-Agent")) {
request.addHeader("User-Agent", request.getFirstHeader("Custom-User-Agent").getValue());
request.removeHeaders("Custom-User-Agent");
}
}
});
}
开发者ID:tonikelope,项目名称:megabasterd,代码行数:32,代码来源:MiscTools.java
示例3: createHttpProcessor
import org.apache.http.client.protocol.RequestAuthCache; //导入依赖的package包/类
/**
* Create the processor with the following interceptors:
* <ul>
* <li>{@link RequestDefaultHeaders}</li>
* <li>{@link RequestContent}</li>
* <li>{@link RequestTargetHost}</li>
* <li>{@link RequestClientConnControl}</li>
* <li>{@link RequestUserAgent}</li>
* <li>{@link RequestExpectContinue}</li>
* <li>{@link RequestAddCookies}</li>
* <li>{@link ResponseProcessCookies}</li>
* <li>{@link RequestAuthCache}</li>
* <li>{@link RequestTargetAuthentication}</li>
* <li>{@link RequestProxyAuthentication}</li>
* </ul>
* <p>
* @return the processor with the added interceptors.
*/
@Override
protected BasicHttpProcessor createHttpProcessor() {
final BasicHttpProcessor httpproc = new BasicHttpProcessor();
httpproc.addInterceptor(new RequestDefaultHeaders());
// Required protocol interceptors
httpproc.addInterceptor(new RequestContent());
httpproc.addInterceptor(new RequestTargetHost());
// Recommended protocol interceptors
httpproc.addInterceptor(new RequestClientConnControl());
httpproc.addInterceptor(new RequestUserAgent());
httpproc.addInterceptor(new RequestExpectContinue());
// HTTP state management interceptors
httpproc.addInterceptor(new RequestAddCookies());
httpproc.addInterceptor(new ResponseProcessCookies());
// HTTP authentication interceptors
httpproc.addInterceptor(new RequestAuthCache());
httpproc.addInterceptor(new RequestTargetAuthentication());
httpproc.addInterceptor(new RequestProxyAuthentication());
return httpproc;
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:39,代码来源:DefaultHttpClient.java
示例4: setUp
import org.apache.http.client.protocol.RequestAuthCache; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
httpClient = HttpClients.createDefault();
credentialsProvider = Mockito.mock(CredentialsProvider.class);
connSettings = TaxiiServiceSettingsFactory.createDefaults();
proxySettings = new ProxySettings();
credentialsProvider = Mockito.mock(CredentialsProvider.class);
factory = new BasicAuthHttpRequestFactory(httpClient, connSettings, proxySettings, credentialsProvider);
MockitoAnnotations.initMocks(this);
when(mockAppender.getName()).thenReturn("MOCK");
Logger authCacheLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(RequestAuthCache.class.getCanonicalName());
authCacheLogger.setLevel(Level.DEBUG);
authCacheLogger.addAppender(mockAppender);
}
开发者ID:CiscoCTA,项目名称:taxii-log-adapter,代码行数:15,代码来源:BasicAuthHttpRequestFactoryTest.java
注:本文中的org.apache.http.client.protocol.RequestAuthCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论