The route for a request. More...
Instances of this class are unmodifiable and therefore suitable for use as lookup keys.
The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Public Member Functions | |
HttpRoute (HttpHost target, InetAddress local, HttpHost[] proxies, boolean secure, TunnelType tunnelled, LayerType layered) | |
Creates a new route with all attributes specified explicitly. More... | |
HttpRoute (HttpHost target, InetAddress local, HttpHost proxy, boolean secure, TunnelType tunnelled, LayerType layered) | |
Creates a new route with at most one proxy. More... | |
HttpRoute (HttpHost target, InetAddress local, boolean secure) | |
Creates a new direct route. More... | |
HttpRoute (HttpHost target) | |
Creates a new direct insecure route. More... | |
HttpRoute (HttpHost target, InetAddress local, HttpHost proxy, boolean secure) | |
Creates a new route through a proxy. More... | |
final HttpHost | getTargetHost () |
Obtains the target host. More... | |
final InetAddress | getLocalAddress () |
Obtains the local address to connect from. More... | |
final int | getHopCount () |
Obtains the number of hops in this route. More... | |
final HttpHost | getHopTarget (int hop) |
Obtains the target of a hop in this route. More... | |
final HttpHost | getProxyHost () |
Obtains the first proxy host. More... | |
final TunnelType | getTunnelType () |
Obtains the tunnel type of this route. More... | |
final boolean | isTunnelled () |
Checks whether this route is tunnelled through a proxy. More... | |
final LayerType | getLayerType () |
Obtains the layering type of this route. More... | |
final boolean | isLayered () |
Checks whether this route includes a layered protocol. More... | |
final boolean | isSecure () |
Checks whether this route is secure. More... | |
final boolean | equals (Object o) |
Compares this route to another. More... | |
final int | hashCode () |
Generates a hash code for this route. More... | |
final String | toString () |
Obtains a description of this route. More... | |
HttpRoute | ( | HttpHost | target, |
InetAddress | local, | ||
HttpHost[] | proxies, | ||
boolean | secure, | ||
TunnelType | tunnelled, | ||
LayerType | layered | ||
) |
target | the host to which to route |
local | the local address to route from, or null for the default |
proxies | the proxy chain to use, or null for a direct route |
secure | true if the route is (to be) secure, false otherwise |
tunnelled | the tunnel type of this route |
layered | the layering type of this route |
HttpRoute | ( | HttpHost | target, |
InetAddress | local, | ||
HttpHost | proxy, | ||
boolean | secure, | ||
TunnelType | tunnelled, | ||
LayerType | layered | ||
) |
target | the host to which to route |
local | the local address to route from, or null for the default |
proxy | the proxy to use, or null for a direct route |
secure | true if the route is (to be) secure, false otherwise |
tunnelled | true if the route is (to be) tunnelled via the proxy, false otherwise |
layered | true if the route includes a layered protocol, false otherwise |
That is a route without a proxy.
target | the host to which to route |
local | the local address to route from, or null for the default |
secure | true if the route is (to be) secure, false otherwise |
When using this constructor, the proxy
MUST be given. For convenience, it is assumed that a secure connection will be layered over a tunnel through the proxy.
target | the host to which to route |
local | the local address to route from, or null for the default |
proxy | the proxy to use |
secure | true if the route is (to be) secure, false otherwise |
final InetAddress getLocalAddress | ( | ) |
null
Implements RouteInfo.
final int getHopCount | ( | ) |
A direct route has one hop. A route through a proxy has two hops. A route through a chain of n proxies has n+1 hops.
Implements RouteInfo.
final HttpHost getHopTarget | ( | int | hop | ) |
The target of the last hop is the target host , the target of previous hops is the respective proxy in the chain. For a route through exactly one proxy, target of hop 0 is the proxy and target of hop 1 is the target host.
hop | index of the hop for which to get the target, 0 for first |
IllegalArgumentException | if the argument is negative or not less than getHopCount() |
Implements RouteInfo.
final HttpHost getProxyHost | ( | ) |
null
if this route is direct Implements RouteInfo.
final TunnelType getTunnelType | ( | ) |
If there is a proxy chain, only end-to-end tunnels are considered.
Implements RouteInfo.
final boolean isTunnelled | ( | ) |
If there is a proxy chain, only end-to-end tunnels are considered.
true
if tunnelled end-to-end through at least one proxy, false
otherwise Implements RouteInfo.
final LayerType getLayerType | ( | ) |
In the presence of proxies, only layering over an end-to-end tunnel is considered.
Implements RouteInfo.
final boolean isLayered | ( | ) |
In the presence of proxies, only layering over an end-to-end tunnel is considered.
true
if layered, false
otherwise Implements RouteInfo.
final boolean isSecure | ( | ) |
true
if secure, false
otherwise Implements RouteInfo.
final boolean equals | ( | Object | o | ) |
o | the object to compare with |
true
if the argument is the same route, false
final int hashCode | ( | ) |
final String toString | ( | ) |