| Constructor: |
public HttpHost(String hostname) {
this(hostname, -1, null);
}
Creates a new HttpHost , with default scheme and port. Parameters:
hostname - the hostname (IP or DNS name)
|
public HttpHost(HttpHost httphost) {
this(httphost.hostname, httphost.port, httphost.schemeName);
}
Parameters:
httphost - the HTTP host to copy details from
|
public HttpHost(String hostname,
int port) {
this(hostname, port, null);
}
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,
int port,
String scheme) {
super();
if (hostname == null) {
throw new IllegalArgumentException("Host name may not be null");
}
this.hostname = hostname;
this.lcHostname = hostname.toLowerCase(Locale.ENGLISH);
if (scheme != null) {
this.schemeName = scheme.toLowerCase(Locale.ENGLISH);
} else {
this.schemeName = DEFAULT_SCHEME_NAME;
}
this.port = port;
}
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
|
| Method from org.apache.http.HttpHost Detail: |
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
|
public boolean equals(Object obj) {
if (obj == null) return false;
if (this == obj) return true;
if (obj instanceof HttpHost) {
HttpHost that = (HttpHost) obj;
return this.lcHostname.equals(that.lcHostname)
&& this.port == that.port
&& this.schemeName.equals(that.schemeName);
} else {
return false;
}
}
|
public String getHostName() {
return this.hostname;
}
|
public int getPort() {
return this.port;
}
|
public String getSchemeName() {
return this.schemeName;
}
|
public int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.lcHostname);
hash = LangUtils.hashCode(hash, this.port);
hash = LangUtils.hashCode(hash, this.schemeName);
return hash;
}
|
public String toHostString() {
CharArrayBuffer buffer = new CharArrayBuffer(32);
buffer.append(this.hostname);
if (this.port != -1) {
buffer.append(':');
buffer.append(Integer.toString(this.port));
}
return buffer.toString();
}
Obtains the host string, without scheme prefix. |
public String toString() {
return toURI();
}
|
public String toURI() {
CharArrayBuffer buffer = new CharArrayBuffer(32);
buffer.append(this.schemeName);
buffer.append("://");
buffer.append(this.hostname);
if (this.port != -1) {
buffer.append(':');
buffer.append(Integer.toString(this.port));
}
return buffer.toString();
}
Return the host URI, as a string. |