Package org.apache.commons.httpclient
Class HttpHost
- java.lang.Object
-
- org.apache.commons.httpclient.HttpHost
-
- All Implemented Interfaces:
java.lang.Cloneable
public class HttpHost extends java.lang.Object implements java.lang.CloneableHolds all of the variables needed to describe an HTTP connection to a host. This includes remote host, port and protocol.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description HttpHost(java.lang.String hostname)Constructor for HttpHost.HttpHost(java.lang.String hostname, int port)Constructor for HttpHost.HttpHost(java.lang.String hostname, int port, org.apache.commons.httpclient.protocol.Protocol protocol)Constructor for HttpHost.HttpHost(HttpHost httphost)Copy constructor for HttpHostHttpHost(org.apache.commons.httpclient.URI uri)URI constructor for HttpHost.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()booleanequals(java.lang.Object o)java.lang.StringgetHostName()Returns the host name (IP or DNS name).intgetPort()Returns the port.org.apache.commons.httpclient.protocol.ProtocolgetProtocol()Returns the protocol.inthashCode()java.lang.StringtoString()java.lang.StringtoURI()Return the host uri.
-
-
-
Constructor Detail
-
HttpHost
public HttpHost(java.lang.String hostname, int port, org.apache.commons.httpclient.protocol.Protocol protocol)Constructor for HttpHost.- Parameters:
hostname- the hostname (IP or DNS name). Can benull.port- the port. Value-1can be used to set default protocol portprotocol- the protocol. Valuenullcan be used to set default protocol
-
HttpHost
public HttpHost(java.lang.String hostname, int port)Constructor for HttpHost.- Parameters:
hostname- the hostname (IP or DNS name). Can benull.port- the port. Value-1can be used to set default protocol port
-
HttpHost
public HttpHost(java.lang.String hostname)
Constructor for HttpHost.- Parameters:
hostname- the hostname (IP or DNS name). Can benull.
-
HttpHost
public HttpHost(org.apache.commons.httpclient.URI uri) throws org.apache.commons.httpclient.URIExceptionURI constructor for HttpHost.- Parameters:
uri- the URI.- Throws:
org.apache.commons.httpclient.URIException
-
HttpHost
public HttpHost(HttpHost httphost)
Copy constructor for HttpHost- Parameters:
httphost- the HTTP host to copy details from
-
-
Method Detail
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Throws:
java.lang.CloneNotSupportedException- See Also:
Object.clone()
-
getHostName
public java.lang.String getHostName()
Returns the host name (IP or DNS name).- Returns:
- the host name (IP or DNS name), or
nullif not set
-
getPort
public int getPort()
Returns the port.- Returns:
- the host port, or
-1if not set
-
getProtocol
public org.apache.commons.httpclient.protocol.Protocol getProtocol()
Returns the protocol.- Returns:
- The protocol.
-
toURI
public java.lang.String toURI()
Return the host uri.- Returns:
- The host uri.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
-