Build 1.0_r1(from source)

org.apache.http
Class HttpHost

java.lang.Object
  extended by org.apache.http.HttpHost
All Implemented Interfaces:
Cloneable

public final class HttpHost
extends Object
implements Cloneable

Holds all of the variables needed to describe an HTTP connection to a host. This includes remote host name, port and scheme.

Since:
4.0

Field Summary
static String DEFAULT_SCHEME_NAME
          The default scheme is "http".
protected  String hostname
          The host to use.
protected  String lcHostname
          The lowercase host, for equals(java.lang.Object) and hashCode().
protected  int port
          The port to use.
protected  String schemeName
          The scheme
 
Constructor Summary
HttpHost(HttpHost httphost)
          Copy constructor for HttpHost.
HttpHost(String hostname)
          Creates a new HttpHost, with default scheme and port.
HttpHost(String hostname, int port)
          Creates a new HttpHost, with default scheme.
HttpHost(String hostname, int port, String scheme)
          Creates a new HttpHost, specifying all values.
 
Method Summary
 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.
 boolean equals(Object obj)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 String getHostName()
          Returns the host name.
 int getPort()
          Returns the port.
 String getSchemeName()
          Returns the scheme name.
 int hashCode()
          Returns an integer hash code for the receiver.
 String toHostString()
          Obtains the host string, without scheme prefix.
 String toString()
          Returns a string containing a concise, human-readable description of the receiver.
 String toURI()
          Return the host URI, as a string.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SCHEME_NAME

public static final String DEFAULT_SCHEME_NAME
The default scheme is "http".

See Also:
Constant Field Values

hostname

protected final String hostname
The host to use.


lcHostname

protected final String lcHostname
The lowercase host, for equals(java.lang.Object) and hashCode().


port

protected final int port
The port to use.


schemeName

protected final String schemeName
The scheme

Constructor Detail

HttpHost

public HttpHost(String hostname,
                int port,
                String scheme)
Creates a new HttpHost, specifying all values. Constructor for HttpHost.

Parameters:
hostname - the hostname (IP or DNS name)
port - the port number. -1 indicates the scheme default port.
scheme - the name of the scheme. null indicates the default scheme

HttpHost

public HttpHost(String hostname,
                int port)
Creates a new HttpHost, with default scheme.

Parameters:
hostname - the hostname (IP or DNS name)
port - the port number. -1 indicates the scheme default port.

HttpHost

public HttpHost(String hostname)
Creates a new HttpHost, with default scheme and port.

Parameters:
hostname - the hostname (IP or DNS name)

HttpHost

public HttpHost(HttpHost httphost)
Copy constructor for HttpHost.

Parameters:
httphost - the HTTP host to copy details from
Method Detail

getHostName

public String getHostName()
Returns the host name.

Returns:
the host name (IP or DNS name)

getPort

public int getPort()
Returns the port.

Returns:
the host port, or -1 if not set

getSchemeName

public String getSchemeName()
Returns the scheme name.

Returns:
the scheme name

toURI

public String toURI()
Return the host URI, as a string.

Returns:
the host URI

toHostString

public String toHostString()
Obtains the host string, without scheme prefix.

Returns:
the host string, for example localhost:8080

toString

public String toString()
Description copied from class: Object
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
String a printable representation for the receiver.

equals

public boolean equals(Object obj)
Description copied from class: Object
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. The implementation in Object returns true only if the argument is the exact same object as the receiver (==).

Overrides:
equals in class Object
Parameters:
obj - Object the object to compare with this object.
Returns:
boolean true if the object is the same as this object false if it is different from this object.
See Also:
Object.hashCode()

hashCode

public int hashCode()
Description copied from class: Object
Returns an integer hash code for the receiver. Any two objects which answer true when passed to .equals must answer the same value for this method.

Overrides:
hashCode in class Object
Returns:
int the receiver's hash.
See Also:
Object.hashCode()

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from class: Object
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.

Overrides:
clone in class Object
Returns:
Object a shallow copy of this object.
Throws:
CloneNotSupportedException - if the receiver's class does not implement the interface Cloneable.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature