Package org.apache.http.conn.routing
Interface RouteInfo
-
- All Known Implementing Classes:
HttpRoute,RouteTracker
public interface RouteInfoRead-only interface for route information.- Since:
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classRouteInfo.LayerTypeThe layering type of a route.static classRouteInfo.TunnelTypeThe tunnelling type of a route.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetHopCount()Obtains the number of hops in this route.HttpHostgetHopTarget(int hop)Obtains the target of a hop in this route.RouteInfo.LayerTypegetLayerType()Obtains the layering type of this route.java.net.InetAddressgetLocalAddress()Obtains the local address to connect from.HttpHostgetProxyHost()Obtains the first proxy host.HttpHostgetTargetHost()Obtains the target host.RouteInfo.TunnelTypegetTunnelType()Obtains the tunnel type of this route.booleanisLayered()Checks whether this route includes a layered protocol.booleanisSecure()Checks whether this route is secure.booleanisTunnelled()Checks whether this route is tunnelled through a proxy.
-
-
-
Method Detail
-
getTargetHost
HttpHost getTargetHost()
Obtains the target host.- Returns:
- the target host
-
getLocalAddress
java.net.InetAddress getLocalAddress()
Obtains the local address to connect from.- Returns:
- the local address,
or
null
-
getHopCount
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.- Returns:
- the number of hops in this route
-
getHopTarget
HttpHost getHopTarget(int hop)
Obtains the target of a hop in this route. The target of the last hop is thetarget 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.- Parameters:
hop- index of the hop for which to get the target, 0 for first- Returns:
- the target of the given hop
- Throws:
java.lang.IllegalArgumentException- if the argument is negative or not less thangetHopCount()
-
getProxyHost
HttpHost getProxyHost()
Obtains the first proxy host.- Returns:
- the first proxy in the proxy chain, or
nullif this route is direct
-
getTunnelType
RouteInfo.TunnelType getTunnelType()
Obtains the tunnel type of this route. If there is a proxy chain, only end-to-end tunnels are considered.- Returns:
- the tunnelling type
-
isTunnelled
boolean isTunnelled()
Checks whether this route is tunnelled through a proxy. If there is a proxy chain, only end-to-end tunnels are considered.- Returns:
trueif tunnelled end-to-end through at least one proxy,falseotherwise
-
getLayerType
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.- Returns:
- the layering type
-
isLayered
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.- Returns:
trueif layered,falseotherwise
-
isSecure
boolean isSecure()
Checks whether this route is secure.- Returns:
trueif secure,falseotherwise
-
-