• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
HttpRoute Class Reference

The route for a request. More...

Inheritance diagram for HttpRoute:
RouteInfo

Description

Instances of this class are unmodifiable and therefore suitable for use as lookup keys.

Author
Roland Weber
Version
Revision
653041
Since
4.0

Notice

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...
 

Constructor & Destructor Documentation

◆ HttpRoute() [1/5]

HttpRoute ( HttpHost  target,
InetAddress  local,
HttpHost[]  proxies,
boolean  secure,
TunnelType  tunnelled,
LayerType  layered 
)
Parameters
targetthe host to which to route
localthe local address to route from, or null for the default
proxiesthe proxy chain to use, or null for a direct route
securetrue if the route is (to be) secure, false otherwise
tunnelledthe tunnel type of this route
layeredthe layering type of this route

◆ HttpRoute() [2/5]

HttpRoute ( HttpHost  target,
InetAddress  local,
HttpHost  proxy,
boolean  secure,
TunnelType  tunnelled,
LayerType  layered 
)
Parameters
targetthe host to which to route
localthe local address to route from, or null for the default
proxythe proxy to use, or null for a direct route
securetrue if the route is (to be) secure, false otherwise
tunnelledtrue if the route is (to be) tunnelled via the proxy, false otherwise
layeredtrue if the route includes a layered protocol, false otherwise

◆ HttpRoute() [3/5]

HttpRoute ( HttpHost  target,
InetAddress  local,
boolean  secure 
)

That is a route without a proxy.

Parameters
targetthe host to which to route
localthe local address to route from, or null for the default
securetrue if the route is (to be) secure, false otherwise

◆ HttpRoute() [4/5]

HttpRoute ( HttpHost  target)
Parameters
targetthe host to which to route

◆ HttpRoute() [5/5]

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

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
targetthe host to which to route
localthe local address to route from, or null for the default
proxythe proxy to use
securetrue if the route is (to be) secure, false otherwise

Member Function Documentation

◆ getTargetHost()

final HttpHost getTargetHost ( )
Returns
the target host

Implements RouteInfo.

◆ getLocalAddress()

final InetAddress getLocalAddress ( )
Returns
the local address, or null

Implements RouteInfo.

◆ getHopCount()

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.

Returns
the number of hops in this route

Implements RouteInfo.

◆ getHopTarget()

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.

Parameters
hopindex of the hop for which to get the target, 0 for first
Returns
the target of the given hop
Exceptions
IllegalArgumentExceptionif the argument is negative or not less than getHopCount()

Implements RouteInfo.

◆ getProxyHost()

final HttpHost getProxyHost ( )
Returns
the first proxy in the proxy chain, or null if this route is direct

Implements RouteInfo.

◆ getTunnelType()

final TunnelType getTunnelType ( )

If there is a proxy chain, only end-to-end tunnels are considered.

Returns
the tunnelling type

Implements RouteInfo.

◆ isTunnelled()

final boolean isTunnelled ( )

If there is a proxy chain, only end-to-end tunnels are considered.

Returns
true if tunnelled end-to-end through at least one proxy, false otherwise

Implements RouteInfo.

◆ getLayerType()

final LayerType getLayerType ( )

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

Returns
the layering type

Implements RouteInfo.

◆ isLayered()

final boolean isLayered ( )

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

Returns
true if layered, false otherwise

Implements RouteInfo.

◆ isSecure()

final boolean isSecure ( )
Returns
true if secure, false otherwise

Implements RouteInfo.

◆ equals()

final boolean equals ( Object  o)
Parameters
othe object to compare with
Returns
true if the argument is the same route, false

◆ hashCode()

final int hashCode ( )
Returns
the hash code

◆ toString()

final String toString ( )
Returns
a human-readable representation of this route