@Immutable public final class HttpHost extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected java.net.InetAddress |
address |
static java.lang.String |
DEFAULT_SCHEME_NAME
The default scheme is "http".
|
protected java.lang.String |
hostname
The host to use.
|
protected java.lang.String |
lcHostname
The lowercase host, for
equals(java.lang.Object) and hashCode(). |
protected int |
port
The port to use, defaults to -1 if not set.
|
protected java.lang.String |
schemeName
The scheme (lowercased)
|
| Constructor and Description |
|---|
HttpHost(HttpHost httphost)
Copy constructor for
HttpHost. |
HttpHost(java.net.InetAddress address)
Creates a new
HttpHost, with default scheme and port. |
HttpHost(java.net.InetAddress address,
int port)
Creates a new
HttpHost, with default scheme. |
HttpHost(java.net.InetAddress address,
int port,
java.lang.String scheme)
Creates a new
HttpHost, specifying all values. |
HttpHost(java.lang.String hostname)
Creates a new
HttpHost, with default scheme and port. |
HttpHost(java.lang.String hostname,
int port)
Creates a new
HttpHost, with default scheme. |
HttpHost(java.lang.String hostname,
int port,
java.lang.String scheme)
Creates a new
HttpHost, specifying all values. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object obj) |
java.net.InetAddress |
getAddress()
Returns the inet address if explicitly set by a constructor,
null otherwise. |
java.lang.String |
getHostName()
Returns the host name.
|
int |
getPort()
Returns the port.
|
java.lang.String |
getSchemeName()
Returns the scheme name.
|
int |
hashCode() |
java.lang.String |
toHostString()
Obtains the host string, without scheme prefix.
|
java.lang.String |
toString() |
java.lang.String |
toURI()
Return the host URI, as a string.
|
public static final java.lang.String DEFAULT_SCHEME_NAME
protected final java.lang.String hostname
protected final java.lang.String lcHostname
equals(java.lang.Object) and hashCode().protected final int port
protected final java.lang.String schemeName
protected final java.net.InetAddress address
public HttpHost(java.lang.String hostname,
int port,
java.lang.String scheme)
HttpHost, specifying all values.
Constructor for HttpHost.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 schemepublic HttpHost(java.lang.String hostname,
int port)
HttpHost, with default scheme.hostname - the hostname (IP or DNS name)port - the port number.
-1 indicates the scheme default port.public HttpHost(java.lang.String hostname)
HttpHost, with default scheme and port.hostname - the hostname (IP or DNS name)public HttpHost(java.net.InetAddress address,
int port,
java.lang.String scheme)
HttpHost, specifying all values.
Constructor for HttpHost.address - the inet address.port - the port number.
-1 indicates the scheme default port.scheme - the name of the scheme.
null indicates the
default schemepublic HttpHost(java.net.InetAddress address,
int port)
HttpHost, with default scheme.address - the inet address.port - the port number.
-1 indicates the scheme default port.public HttpHost(java.net.InetAddress address)
HttpHost, with default scheme and port.address - the inet address.public java.lang.String getHostName()
public int getPort()
-1 if not setpublic java.lang.String getSchemeName()
public java.net.InetAddress getAddress()
null otherwise.public java.lang.String toURI()
public java.lang.String toHostString()
localhost:8080public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException