org.apache.commons.httpclient

Class HttpHost

Implemented Interfaces:
Cloneable
Known Direct Subclasses:
ProxyHost

public class HttpHost
extends Object
implements Cloneable

Holds 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

HttpHost(String hostname)
Constructor for HttpHost.
HttpHost(String hostname, int port)
Constructor for HttpHost.
HttpHost(String hostname, int port, Protocol protocol)
Constructor for HttpHost.
HttpHost(HttpHost httphost)
Copy constructor for HttpHost
HttpHost(URI uri)
URI constructor for HttpHost.

Method Summary

Object
clone()
boolean
equals(Object o)
String
getHostName()
Returns the host name (IP or DNS name).
int
getPort()
Returns the port.
Protocol
getProtocol()
Returns the protocol.
int
hashCode()
String
toString()
String
toURI()
Return the host uri.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

HttpHost

public HttpHost(String hostname)
Constructor for HttpHost.
Parameters:
hostname - the hostname (IP or DNS name). Can be null.
Usages and Demos :

View More Examples of HttpHost(String hostname)
   1:         HostConfiguration config = client.getHostConfiguration();
   2:         config.setHost(new HttpHost(theURL.getHost(), theURL.getPort()));
   3:         if (theProxyHost != null && theProxyHost.length() > 0)
   4:         {
   5:             config.setProxyHost(new ProxyHost(theProxyHost, theProxyPort == null ? -1 : theProxyPort.intValue()));

View Full Code Here

HttpHost

public HttpHost(String hostname,
                int port)
Constructor for HttpHost.
Parameters:
hostname - the hostname (IP or DNS name). Can be null.
port - the port. Value -1 can be used to set default protocol port

HttpHost

public HttpHost(String hostname,
                int port,
                Protocol protocol)
Constructor for HttpHost.
Parameters:
hostname - the hostname (IP or DNS name). Can be null.
port - the port. Value -1 can be used to set default protocol port
protocol - the protocol. Value null can be used to set default protocol

HttpHost

public HttpHost(HttpHost httphost)
Copy constructor for HttpHost
Parameters:
httphost - the HTTP host to copy details from
Usages and Demos :

View More Examples of HttpHost(HttpHost httphost)
   1:         HostConfiguration config = client.getHostConfiguration();
   2:         config.setHost(new HttpHost(theURL.getHost(), theURL.getPort()));
   3:         if (theProxyHost != null && theProxyHost.length() > 0)
   4:         {
   5:             config.setProxyHost(new ProxyHost(theProxyHost, theProxyPort == null ? -1 : theProxyPort.intValue()));

View Full Code Here

HttpHost

public HttpHost(URI uri)
            throws URIException
URI constructor for HttpHost.
Parameters:
uri - the URI.
Usages and Demos :

View More Examples of HttpHost(URI uri)
   1:         HostConfiguration config = client.getHostConfiguration();
   2:         config.setHost(new HttpHost(theURL.getHost(), theURL.getPort()));
   3:         if (theProxyHost != null && theProxyHost.length() > 0)
   4:         {
   5:             config.setProxyHost(new ProxyHost(theProxyHost, theProxyPort == null ? -1 : theProxyPort.intValue()));

View Full Code Here

Method Details

clone

public Object clone()
            throws CloneNotSupportedException
Overrides:
clone in interface Object

equals

public boolean equals(Object o)
Overrides:
equals in interface Object

getHostName

public String getHostName()
Returns the host name (IP or DNS name).
Returns:
the host name (IP or DNS name), or null if not set

getPort

public int getPort()
Returns the port.
Returns:
the host port, or -1 if not set

getProtocol

public Protocol getProtocol()
Returns the protocol.
Returns:
The protocol.

hashCode

public int hashCode()
Overrides:
hashCode in interface Object

toString

public String toString()
Overrides:
toString in interface Object

toURI

public String toURI()
Return the host uri.
Returns:
The host uri.