org.apache.http
public
final
class
org.apache.http.HttpHost
Holds all of the variables needed to describe an HTTP connection to a host.
This includes remote host name, port and scheme.
Summary
Constants
Fields
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
String
DEFAULT_SCHEME_NAME
The default scheme is "http".
Constant Value:
"http"
Fields
protected
final
String
hostname
The host to use.
protected
final
String
lcHostname
protected
final
int
port
The port to use.
protected
final
String
schemeName
The scheme
Public Constructors
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
|
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.
|
public
HttpHost(String hostname)
Creates a new
HttpHost, with default scheme and port.
Parameters
hostname
| the hostname (IP or DNS name)
|
public
HttpHost(HttpHost httphost)
Copy constructor for
HttpHost.
Parameters
httphost
| the HTTP host to copy details from
|
Public Methods
public
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.
Classes which wish to support cloning must specify that they implement
the Cloneable interface, since the implementation checks for this.
Returns
- Object a shallow copy of this object.
public
boolean
equals(Object obj)
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 (==).
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.
public
String
getHostName()
Returns the host name.
Returns
- the host name (IP or DNS name)
public
int
getPort()
Returns the port.
Returns
- the host port, or
-1
if not set
public
int
hashCode()
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.
public
String
toHostString()
Obtains the host string, without scheme prefix.
Returns
- the host string, for example
localhost:8080
public
String
toString()
Returns a string containing a concise, human-readable description of the
receiver.
Returns
- String a printable representation for the receiver.
public
String
toURI()
Return the host URI, as a string.