Class HttpHost
java.lang.Object
org.apache.http.HttpHost
- All Implemented Interfaces:
Serializable, Cloneable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final InetAddressstatic final StringThe default scheme is "http".protected final StringThe host to use.protected final StringThe lowercase host, forequals(Object)andhashCode().protected final intThe port to use, defaults to -1 if not set.protected final StringThe scheme (lowercased) -
Constructor Summary
ConstructorsConstructorDescriptionCreatesHttpHostinstance with the default scheme and port and the given hostname.CreatesHttpHostinstance with the default scheme and the given hostname and port.CreatesHttpHostinstance with the given scheme, hostname and port.HttpHost(InetAddress address) CreatesHttpHostinstance with the default scheme and port and the given inet address.HttpHost(InetAddress address, int port) CreatesHttpHostinstance with the default scheme and the given inet address and port.HttpHost(InetAddress address, int port, String scheme) CreatesHttpHostinstance with the given scheme, inet address and port.HttpHost(InetAddress address, String hostname, int port, String scheme) Creates a newHttpHost, specifying all values.Copy constructor forHttpHost. -
Method Summary
Modifier and TypeMethodDescriptionclone()static HttpHostCreatesHttpHostinstance from string.booleanReturns the inet address if explicitly set by a constructor,nullotherwise.Returns the host name.intgetPort()Returns the port.Returns the scheme name.inthashCode()Obtains the host string, without scheme prefix.toString()toURI()Return the host URI, as a string.
-
Field Details
-
DEFAULT_SCHEME_NAME
-
hostname
The host to use. -
lcHostname
The lowercase host, forequals(Object)andhashCode(). -
port
protected final int portThe port to use, defaults to -1 if not set. -
schemeName
The scheme (lowercased) -
address
-
-
Constructor Details
-
HttpHost
CreatesHttpHostinstance with the given scheme, hostname and port.- Parameters:
hostname- the hostname (IP or DNS name)port- the port number.-1indicates the scheme default port.scheme- the name of the scheme.nullindicates thedefault scheme
-
HttpHost
CreatesHttpHostinstance with the default scheme and the given hostname and port.- Parameters:
hostname- the hostname (IP or DNS name)port- the port number.-1indicates the scheme default port.
-
HttpHost
CreatesHttpHostinstance with the default scheme and port and the given hostname.- Parameters:
hostname- the hostname (IP or DNS name)
-
HttpHost
CreatesHttpHostinstance with the given scheme, inet address and port.- Parameters:
address- the inet address.port- the port number.-1indicates the scheme default port.scheme- the name of the scheme.nullindicates thedefault scheme- Since:
- 4.3
-
HttpHost
Creates a newHttpHost, specifying all values. Constructor for HttpHost.- Parameters:
address- the inet address.hostname- the hostname (IP or DNS name)port- the port number.-1indicates the scheme default port.scheme- the name of the scheme.nullindicates thedefault scheme- Since:
- 4.4
-
HttpHost
CreatesHttpHostinstance with the default scheme and the given inet address and port.- Parameters:
address- the inet address.port- the port number.-1indicates the scheme default port.- Since:
- 4.3
-
HttpHost
CreatesHttpHostinstance with the default scheme and port and the given inet address.- Parameters:
address- the inet address.- Since:
- 4.3
-
HttpHost
-
-
Method Details
-
create
-
getHostName
-
getPort
public int getPort()Returns the port.- Returns:
- the host port, or
-1if not set
-
getSchemeName
-
getAddress
Returns the inet address if explicitly set by a constructor,nullotherwise.- Returns:
- the inet address
- Since:
- 4.3
-
toURI
-
toHostString
Obtains the host string, without scheme prefix.- Returns:
- the host string, for example
localhost:8080
-
toString
-
equals
-
hashCode
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-