Example usage for org.apache.http.impl.auth BasicSchemeHC4 BasicSchemeHC4

List of usage examples for org.apache.http.impl.auth BasicSchemeHC4 BasicSchemeHC4

Introduction

In this page you can find the example usage for org.apache.http.impl.auth BasicSchemeHC4 BasicSchemeHC4.

Prototype

public BasicSchemeHC4() 

Source Link

Usage

From source file:com.granita.icloudcalsync.webdav.WebDavResource.java

public WebDavResource(CloseableHttpClient httpClient, URI baseURI, String username, String password,
        boolean preemptive) {
    this(httpClient, baseURI);

    context.getCredentialsProvider().setCredentials(AuthScope.ANY,
            new UsernamePasswordCredentials(username, password));

    if (preemptive) {
        HttpHost host = new HttpHost(baseURI.getHost(), baseURI.getPort(), baseURI.getScheme());
        Log.d(TAG, "Using preemptive authentication (not compatible with Digest auth)");
        AuthCache authCache = context.getAuthCache();
        if (authCache == null)
            authCache = new BasicAuthCache();
        authCache.put(host, new BasicSchemeHC4());
        context.setAuthCache(authCache);
    }/* w w  w  .j  ava  2  s .  com*/
}