use of org.apache.http.protocol.BasicHttpContext in project XobotOS by xamarin.
the class DefaultHttpClient method createHttpContext.
@Override
protected HttpContext createHttpContext() {
HttpContext context = new BasicHttpContext();
context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, getAuthSchemes());
context.setAttribute(ClientContext.COOKIESPEC_REGISTRY, getCookieSpecs());
context.setAttribute(ClientContext.COOKIE_STORE, getCookieStore());
context.setAttribute(ClientContext.CREDS_PROVIDER, getCredentialsProvider());
return context;
}
use of org.apache.http.protocol.BasicHttpContext in project camel by apache.
the class HttpReferenceParameterTest method setUp.
@Override
public void setUp() throws Exception {
this.testBinding = new TestHttpBinding();
this.testConfigurer = new TestClientConfigurer();
this.testHttpContext = new BasicHttpContext();
super.setUp();
this.endpoint1 = context.getEndpoint(TEST_URI_1, HttpEndpoint.class);
this.endpoint2 = context.getEndpoint(TEST_URI_2, HttpEndpoint.class);
}
use of org.apache.http.protocol.BasicHttpContext in project robovm by robovm.
the class DefaultHttpClient method createHttpContext.
@Override
protected HttpContext createHttpContext() {
HttpContext context = new BasicHttpContext();
context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, getAuthSchemes());
context.setAttribute(ClientContext.COOKIESPEC_REGISTRY, getCookieSpecs());
context.setAttribute(ClientContext.COOKIE_STORE, getCookieStore());
context.setAttribute(ClientContext.CREDS_PROVIDER, getCredentialsProvider());
return context;
}
use of org.apache.http.protocol.BasicHttpContext in project Lucee by lucee.
the class HTTPEngine4Impl method setCredentials.
public static BasicHttpContext setCredentials(HttpClientBuilder builder, HttpHost httpHost, String username, String password, boolean preAuth) {
// set Username and Password
if (!StringUtil.isEmpty(username, true)) {
if (password == null)
password = "";
CredentialsProvider cp = new BasicCredentialsProvider();
builder.setDefaultCredentialsProvider(cp);
cp.setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(username, password));
BasicHttpContext httpContext = new BasicHttpContext();
if (preAuth) {
AuthCache authCache = new BasicAuthCache();
authCache.put(httpHost, new BasicScheme());
httpContext.setAttribute(ClientContext.AUTH_CACHE, authCache);
}
return httpContext;
}
return null;
}
use of org.apache.http.protocol.BasicHttpContext in project tmdm-studio-se by Talend.
the class HttpClientUtil method getPreemptiveContext.
private static HttpContext getPreemptiveContext(HttpHost targetHost) {
AuthCache authCache = new BasicAuthCache();
BasicScheme basicAuth = new BasicScheme();
authCache.put(targetHost, basicAuth);
// Add AuthCache to the execution context
BasicHttpContext localcontext = new BasicHttpContext();
localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);
return localcontext;
}
Aggregations