当前位置: 首页>>代码示例>>Java>>正文


Java AuthCache类代码示例

本文整理汇总了Java中ch.boye.httpclientandroidlib.client.AuthCache的典型用法代码示例。如果您正苦于以下问题:Java AuthCache类的具体用法?Java AuthCache怎么用?Java AuthCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AuthCache类属于ch.boye.httpclientandroidlib.client包,在下文中一共展示了AuthCache类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: authSucceeded

import ch.boye.httpclientandroidlib.client.AuthCache; //导入依赖的package包/类
public void authSucceeded(
        final HttpHost authhost, final AuthScheme authScheme, final HttpContext context) {
    Args.notNull(authhost, "Host");
    Args.notNull(authScheme, "Auth scheme");
    Args.notNull(context, "HTTP context");

    final HttpClientContext clientContext = HttpClientContext.adapt(context);

    if (isCachable(authScheme)) {
        AuthCache authCache = clientContext.getAuthCache();
        if (authCache == null) {
            authCache = new BasicAuthCache();
            clientContext.setAuthCache(authCache);
        }
        if (this.log.isDebugEnabled()) {
            this.log.debug("Caching '" + authScheme.getSchemeName() +
                    "' auth scheme for " + authhost);
        }
        authCache.put(authhost, authScheme);
    }
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:22,代码来源:AuthenticationStrategyImpl.java

示例2: cache

import ch.boye.httpclientandroidlib.client.AuthCache; //导入依赖的package包/类
private void cache(final AuthCache authCache, final HttpHost host, final AuthScheme authScheme) {
    if (this.log.isDebugEnabled()) {
        this.log.debug("Caching '" + authScheme.getSchemeName() +
                "' auth scheme for " + host);
    }
    authCache.put(host, authScheme);
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:8,代码来源:ResponseAuthCache.java

示例3: uncache

import ch.boye.httpclientandroidlib.client.AuthCache; //导入依赖的package包/类
private void uncache(final AuthCache authCache, final HttpHost host, final AuthScheme authScheme) {
    if (this.log.isDebugEnabled()) {
        this.log.debug("Removing from cache '" + authScheme.getSchemeName() +
                "' auth scheme for " + host);
    }
    authCache.remove(host);
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:8,代码来源:ResponseAuthCache.java

示例4: authSucceeded

import ch.boye.httpclientandroidlib.client.AuthCache; //导入依赖的package包/类
public void authSucceeded(
        final HttpHost authhost, final AuthScheme authScheme, final HttpContext context) {
    AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE);
    if (isCachable(authScheme)) {
        if (authCache == null) {
            authCache = new BasicAuthCache();
            context.setAttribute(ClientContext.AUTH_CACHE, authCache);
        }
        if (this.log.isDebugEnabled()) {
            this.log.debug("Caching '" + authScheme.getSchemeName() +
                    "' auth scheme for " + authhost);
        }
        authCache.put(authhost, authScheme);
    }
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:16,代码来源:AuthenticationStrategyAdaptor.java

示例5: authFailed

import ch.boye.httpclientandroidlib.client.AuthCache; //导入依赖的package包/类
public void authFailed(
        final HttpHost authhost, final AuthScheme authScheme, final HttpContext context) {
    final AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE);
    if (authCache == null) {
        return;
    }
    if (this.log.isDebugEnabled()) {
        this.log.debug("Removing from cache '" + authScheme.getSchemeName() +
                "' auth scheme for " + authhost);
    }
    authCache.remove(authhost);
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:13,代码来源:AuthenticationStrategyAdaptor.java

示例6: authFailed

import ch.boye.httpclientandroidlib.client.AuthCache; //导入依赖的package包/类
public void authFailed(
        final HttpHost authhost, final AuthScheme authScheme, final HttpContext context) {
    Args.notNull(authhost, "Host");
    Args.notNull(context, "HTTP context");

    final HttpClientContext clientContext = HttpClientContext.adapt(context);

    final AuthCache authCache = clientContext.getAuthCache();
    if (authCache != null) {
        if (this.log.isDebugEnabled()) {
            this.log.debug("Clearing cached auth scheme for " + authhost);
        }
        authCache.remove(authhost);
    }
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:16,代码来源:AuthenticationStrategyImpl.java

示例7: getAuthCache

import ch.boye.httpclientandroidlib.client.AuthCache; //导入依赖的package包/类
public AuthCache getAuthCache() {
    return getAttribute(AUTH_CACHE, AuthCache.class);
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:4,代码来源:HttpClientContext.java

示例8: setAuthCache

import ch.boye.httpclientandroidlib.client.AuthCache; //导入依赖的package包/类
public void setAuthCache(final AuthCache authCache) {
    setAttribute(AUTH_CACHE, authCache);
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:4,代码来源:HttpClientContext.java

示例9: addAuthCacheToContext

import ch.boye.httpclientandroidlib.client.AuthCache; //导入依赖的package包/类
/**
 * This shuts up HttpClient, which will otherwise debug log about there
 * being no auth cache in the context.
 */
private static void addAuthCacheToContext(HttpUriRequest request, HttpContext context) {
  AuthCache authCache = new BasicAuthCache();                // Not thread safe.
  context.setAttribute(ClientContext.AUTH_CACHE, authCache);
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:9,代码来源:BaseResource.java


注:本文中的ch.boye.httpclientandroidlib.client.AuthCache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。