org.apache.http.conn
Class HostConfiguration

java.lang.Object
  extended by org.apache.http.conn.HostConfiguration

public class HostConfiguration
extends java.lang.Object

Provides configuration data for connecting to a host. That is the host to connect to plus a proxy to use or a local IP address to select one of several network interfaces. Instances of this class are immutable. Instances of derived classes should be immutable, too.

Since:
4.0
Author:
Roland Weber, Michael Becke, Mike Bowler, Oleg Kalnichevski, Laura Werner

Field Summary
static HostConfiguration ANY_HOST_CONFIGURATION
          Constant representing a configuration for any host.
 
Constructor Summary
HostConfiguration(org.apache.http.HttpHost host, org.apache.http.HttpHost proxy, java.net.InetAddress laddr)
          Creates a new host configuration.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 org.apache.http.HttpHost getHost()
          Returns the target host.
 java.net.InetAddress getLocalAddress()
          Return the local address to be used when creating connections.
 org.apache.http.HttpHost getProxyHost()
          Returns the proxy to use.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANY_HOST_CONFIGURATION

public static final HostConfiguration ANY_HOST_CONFIGURATION
Constant representing a configuration for any host. That means to no host in particular. Use this constant in cases where you'd otherwise pass null to refer to a default value that applies to "any" host.

Constructor Detail

HostConfiguration

public HostConfiguration(org.apache.http.HttpHost host,
                         org.apache.http.HttpHost proxy,
                         java.net.InetAddress laddr)
Creates a new host configuration.

Parameters:
host - the target host to connect to
proxy - the proxy host to use, or null for a direct connection
laddr - the local IP address to use, or null for any
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getHost

public org.apache.http.HttpHost getHost()
Returns the target host.

Returns:
the target host, or null if this is ANY_HOST_CONFIGURATION

getProxyHost

public org.apache.http.HttpHost getProxyHost()
Returns the proxy to use.

Returns:
the proxy host, or null if not set

getLocalAddress

public java.net.InetAddress getLocalAddress()
Return the local address to be used when creating connections. If this is unset, the default address should be used.

Returns:
the local address to be used when creating Sockets, or null

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.