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

org.apache.http.conn.routing.RouteTracker

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

Helps tracking the steps in establishing a route.

Summary

Public Constructors

            RouteTracker(HttpHost target, InetAddress local)
Creates a new route tracker.
            RouteTracker(HttpRoute route)
Creates a new tracker for the given route.

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      void  connectProxy(HttpHost proxy, boolean secure)
Tracks connecting to the first proxy.
    final      void  connectTarget(boolean secure)
Tracks connecting to the target.
    final      boolean  equals(Object o)
Compares this tracked 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 tracked route.
    final      boolean  isConnected()
    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      void  layerProtocol(boolean secure)
Tracks layering a protocol.
    final      HttpRoute  toRoute()
Obtains the tracked route.
    final      String  toString()
Obtains a description of the tracked route.
    final      void  tunnelProxy(HttpHost proxy, boolean secure)
Tracks tunnelling to a proxy in a proxy chain.
    final      void  tunnelTarget(boolean secure)
Tracks tunnelling to the target.
Methods inherited from class java.lang.Object
Methods inherited from interface org.apache.http.conn.routing.RouteInfo

Details

Public Constructors

public RouteTracker(HttpHost target, InetAddress local)

Creates a new route tracker. The target and origin need to be specified at creation time.

Parameters

target the host to which to route
local the local address to route from, or null for the default

public RouteTracker(HttpRoute route)

Creates a new tracker for the given route. Only target and origin are taken from the route, everything else remains to be tracked.

Parameters

route the route to track

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 void connectProxy(HttpHost proxy, boolean secure)

Tracks connecting to the first proxy.

Parameters

proxy the proxy connected to
secure true if the route is secure, false otherwise

public final void connectTarget(boolean secure)

Tracks connecting to the target.

Parameters

secure true if the route is secure, false otherwise

public final boolean equals(Object o)

Compares this tracked route to another.

Parameters

o the object to compare with

Returns

  • true if the argument is the same tracked 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 tracked route. Route trackers are modifiable and should therefore not be used as lookup keys. Use toRoute to obtain an unmodifiable representation of the tracked route.

Returns

  • the hash code

public final boolean isConnected()

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 void layerProtocol(boolean secure)

Tracks layering a protocol.

Parameters

secure true if the route is secure, false otherwise

public final HttpRoute toRoute()

Obtains the tracked route. If a route has been tracked, it is connected. If not connected, nothing has been tracked so far.

Returns

  • the tracked route, or null if nothing has been tracked so far

public final String toString()

Obtains a description of the tracked route.

Returns

  • a human-readable representation of the tracked route

public final void tunnelProxy(HttpHost proxy, boolean secure)

Tracks tunnelling to a proxy in a proxy chain. This will extend the tracked proxy chain, but it does not mark the route as tunnelled. Only end-to-end tunnels are considered there.

Parameters

proxy the proxy tunnelled to
secure true if the route is secure, false otherwise

public final void tunnelTarget(boolean secure)

Tracks tunnelling to the target.

Parameters

secure true if the route is secure, false otherwise
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56