Android
org.apache.http.conn.routing
public final class

org.apache.http.conn.routing.HttpRoute

java.lang.Object
org.apache.http.conn.routing.HttpRoute Cloneable RouteInfo

The route for a request. Instances of this class are unmodifiable and therefore suitable for use as lookup keys.

Summary

Public Constructors

            HttpRoute(HttpHost target, InetAddress local, HttpHost[] proxies, boolean secure, RouteInfo.TunnelType tunnelled, RouteInfo.LayerType layered)
Creates a new route with all attributes specified explicitly.
            HttpRoute(HttpHost target, InetAddress local, HttpHost proxy, boolean secure, RouteInfo.TunnelType tunnelled, RouteInfo.LayerType layered)
Creates a new route with at most one proxy.
            HttpRoute(HttpHost target, InetAddress local, boolean secure)
Creates a new direct route.
            HttpRoute(HttpHost target)
Creates a new direct insecure route.
            HttpRoute(HttpHost target, InetAddress local, HttpHost proxy, boolean secure)
Creates a new route through a proxy.

Public Methods

          Object  clone()
Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    final      boolean  equals(Object o)
Compares this route to another.
    final      int  getHopCount()
Obtains the number of hops in this route.
    final      HttpHost  getHopTarget(int hop)
Obtains the target of a hop in this route.
    final      RouteInfo.LayerType  getLayerType()
Obtains the layering type of this route.
    final      InetAddress  getLocalAddress()
Obtains the local address to connect from.
    final      HttpHost  getProxyHost()
Obtains the first proxy host.
    final      HttpHost  getTargetHost()
Obtains the target host.
    final      RouteInfo.TunnelType  getTunnelType()
Obtains the tunnel type of this route.
    final      int  hashCode()
Generates a hash code for this route.
    final      boolean  isLayered()
Checks whether this route includes a layered protocol.
    final      boolean  isSecure()
Checks whether this route is secure.
    final      boolean  isTunnelled()
Checks whether this route is tunnelled through a proxy.
    final      String  toString()
Obtains a description of this route.
Methods inherited from class java.lang.Object
Methods inherited from interface org.apache.http.conn.routing.RouteInfo

Details

Public Constructors

public HttpRoute(HttpHost target, InetAddress local, HttpHost[] proxies, boolean secure, RouteInfo.TunnelType tunnelled, RouteInfo.LayerType layered)

Creates a new route with all attributes specified explicitly.

Parameters

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

public HttpRoute(HttpHost target, InetAddress local, HttpHost proxy, boolean secure, RouteInfo.TunnelType tunnelled, RouteInfo.LayerType layered)

Creates a new route with at most one proxy.

Parameters

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

public HttpRoute(HttpHost target, InetAddress local, boolean secure)

Creates a new direct route. That is a route without a proxy.

Parameters

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

public HttpRoute(HttpHost target)

Creates a new direct insecure route.

Parameters

target the host to which to route

public HttpRoute(HttpHost target, InetAddress local, HttpHost proxy, boolean secure)

Creates a new route through a proxy. 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.

Parameters

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

Public Methods

public Object clone()

Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.

Classes which wish to support cloning must specify that they implement the Cloneable interface, since the implementation checks for this.

Returns

  • Object a shallow copy of this object.

public final boolean equals(Object o)

Compares this route to another.

Parameters

o the object to compare with

Returns

  • true if the argument is the same route, false

public final int getHopCount()

Obtains the number of hops in this route. 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.

public final HttpHost getHopTarget(int hop)

Obtains the target of a hop in this route. 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.

public final RouteInfo.LayerType getLayerType()

Obtains the layering type of this route. In the presence of proxies, only layering over an end-to-end tunnel is considered.

public final InetAddress getLocalAddress()

Obtains the local address to connect from.

public final HttpHost getProxyHost()

Obtains the first proxy host.

public final HttpHost getTargetHost()

Obtains the target host.

public final RouteInfo.TunnelType getTunnelType()

Obtains the tunnel type of this route. If there is a proxy chain, only end-to-end tunnels are considered.

public final int hashCode()

Generates a hash code for this route.

Returns

  • the hash code

public final boolean isLayered()

Checks whether this route includes a layered protocol. In the presence of proxies, only layering over an end-to-end tunnel is considered.

public final boolean isSecure()

Checks whether this route is secure.

public final boolean isTunnelled()

Checks whether this route is tunnelled through a proxy. If there is a proxy chain, only end-to-end tunnels are considered.

public final String toString()

Obtains a description of this route.

Returns

  • a human-readable representation of this route
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56