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


Java Scheme.isLayered方法代码示例

本文整理汇总了Java中ch.boye.httpclientandroidlib.conn.scheme.Scheme.isLayered方法的典型用法代码示例。如果您正苦于以下问题:Java Scheme.isLayered方法的具体用法?Java Scheme.isLayered怎么用?Java Scheme.isLayered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ch.boye.httpclientandroidlib.conn.scheme.Scheme的用法示例。


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

示例1: determineRoute

import ch.boye.httpclientandroidlib.conn.scheme.Scheme; //导入方法依赖的package包/类
public HttpRoute determineRoute(final HttpHost target,
                                final HttpRequest request,
                                final HttpContext context)
    throws HttpException {

    Args.notNull(request, "HTTP request");

    // If we have a forced route, we can do without a target.
    HttpRoute route =
        ConnRouteParams.getForcedRoute(request.getParams());
    if (route != null) {
        return route;
    }

    // If we get here, there is no forced route.
    // So we need a target to compute a route.

    Asserts.notNull(target, "Target host");

    final InetAddress local =
        ConnRouteParams.getLocalAddress(request.getParams());
    final HttpHost proxy = determineProxy(target, request, context);

    final Scheme schm =
        this.schemeRegistry.getScheme(target.getSchemeName());
    // as it is typically used for TLS/SSL, we assume that
    // a layered scheme implies a secure connection
    final boolean secure = schm.isLayered();

    if (proxy == null) {
        route = new HttpRoute(target, local, secure);
    } else {
        route = new HttpRoute(target, local, proxy, secure);
    }
    return route;
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:37,代码来源:ProxySelectorRoutePlanner.java

示例2: determineRoute

import ch.boye.httpclientandroidlib.conn.scheme.Scheme; //导入方法依赖的package包/类
public HttpRoute determineRoute(final HttpHost target,
                                final HttpRequest request,
                                final HttpContext context)
    throws HttpException {

    Args.notNull(request, "HTTP request");

    // If we have a forced route, we can do without a target.
    HttpRoute route =
        ConnRouteParams.getForcedRoute(request.getParams());
    if (route != null) {
        return route;
    }

    // If we get here, there is no forced route.
    // So we need a target to compute a route.

    Asserts.notNull(target, "Target host");

    final InetAddress local =
        ConnRouteParams.getLocalAddress(request.getParams());
    final HttpHost proxy =
        ConnRouteParams.getDefaultProxy(request.getParams());

    final Scheme schm;
    try {
        schm = this.schemeRegistry.getScheme(target.getSchemeName());
    } catch (final IllegalStateException ex) {
        throw new HttpException(ex.getMessage());
    }
    // as it is typically used for TLS/SSL, we assume that
    // a layered scheme implies a secure connection
    final boolean secure = schm.isLayered();

    if (proxy == null) {
        route = new HttpRoute(target, local, secure);
    } else {
        route = new HttpRoute(target, local, proxy, secure);
    }
    return route;
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:42,代码来源:DefaultHttpRoutePlanner.java


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