本文整理汇总了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;
}
示例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;
}