| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.http.HttpHost
@Contract(threading=IMMUTABLE) public final class HttpHost
Holds all of the variables needed to describe an HTTP connection to a host. This includes remote host name, port and scheme.
| Field Summary | |
|---|---|
| protected  InetAddress | address | 
| static String | DEFAULT_SCHEME_NAMEThe default scheme is "http". | 
| protected  String | hostnameThe host to use. | 
| protected  String | lcHostnameThe lowercase host, for equals(java.lang.Object)andhashCode(). | 
| protected  int | portThe port to use, defaults to -1 if not set. | 
| protected  String | schemeNameThe scheme (lowercased) | 
| Constructor Summary | |
|---|---|
| HttpHost(HttpHost httphost)Copy constructor for HttpHost. | |
| HttpHost(InetAddress address)Creates HttpHostinstance with the default scheme and port and the given inet
 address. | |
| HttpHost(InetAddress address,
         int port)Creates HttpHostinstance with the default scheme and the given inet address
 and port. | |
| HttpHost(InetAddress address,
         int port,
         String scheme)Creates HttpHostinstance with the given scheme, inet address and port. | |
| HttpHost(InetAddress address,
         String hostname,
         int port,
         String scheme)Creates a new HttpHost, specifying all values. | |
| HttpHost(String hostname)Creates HttpHostinstance with the default scheme and port and the given hostname. | |
| HttpHost(String hostname,
         int port)Creates HttpHostinstance with the default scheme and the given hostname and port. | |
| HttpHost(String hostname,
         int port,
         String scheme)Creates HttpHostinstance with the given scheme, hostname and port. | |
| Method Summary | |
|---|---|
|  Object | clone() | 
| static HttpHost | create(String s)Creates HttpHostinstance from string. | 
|  boolean | equals(Object obj) | 
|  InetAddress | getAddress()Returns the inet address if explicitly set by a constructor, nullotherwise. | 
|  String | getHostName()Returns the host name. | 
|  int | getPort()Returns the port. | 
|  String | getSchemeName()Returns the scheme name. | 
|  int | hashCode() | 
|  String | toHostString()Obtains the host string, without scheme prefix. | 
|  String | toString() | 
|  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 | 
|---|
public static final String DEFAULT_SCHEME_NAME
protected final String hostname
protected final String lcHostname
equals(java.lang.Object) and hashCode().
protected final int port
protected final String schemeName
protected final InetAddress address
| Constructor Detail | 
|---|
public HttpHost(String hostname,
                int port,
                String scheme)
HttpHost instance with the given scheme, hostname and port.
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
public HttpHost(String hostname,
                int port)
HttpHost instance with the default scheme and the given hostname and port.
hostname - the hostname (IP or DNS name)port - the port number.
                  -1 indicates the scheme default port.public HttpHost(String hostname)
HttpHost instance with the default scheme and port and the given hostname.
hostname - the hostname (IP or DNS name)
public HttpHost(InetAddress address,
                int port,
                String scheme)
HttpHost instance with the given scheme, inet address and port.
address - the inet address.port - the port number.
                  -1 indicates the scheme default port.scheme - the name of the scheme.
                  null indicates the
                  default scheme
public HttpHost(InetAddress address,
                String hostname,
                int port,
                String scheme)
HttpHost, specifying all values.
 Constructor for HttpHost.
address - the inet address.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
public HttpHost(InetAddress address,
                int port)
HttpHost instance with the default scheme and the given inet address
 and port.
address - the inet address.port - the port number.
                  -1 indicates the scheme default port.public HttpHost(InetAddress address)
HttpHost instance with the default scheme and port and the given inet
 address.
address - the inet address.public HttpHost(HttpHost httphost)
HttpHost.
httphost - the HTTP host to copy details from| Method Detail | 
|---|
public static HttpHost create(String s)
HttpHost instance from string. Text may not contain any blanks.
public String getHostName()
public int getPort()
-1 if not setpublic String getSchemeName()
public InetAddress getAddress()
null otherwise.
public String toURI()
public String toHostString()
localhost:8080public String toString()
toString in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class ObjectObject.hashCode()
public Object clone()
             throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||