HttpHost (HttpClient Library (Version 3.1))
Date: 2016-03-09

org.apache.commons.httpclient

## Class HttpHost

- java.lang.Object
- - org.apache.commons.httpclient.HttpHost

- All Implemented Interfaces:
    java.lang.Cloneable
  Direct Known Subclasses:
    ProxyHost

      public class HttpHost
      extends java.lang.Object
      implements java.lang.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
  Author:
    Michael Becke, Mike Bowler, Oleg Kalnichevski, Laura Werner

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpHost(HttpHost httphost)` Copy constructor for HttpHost
    `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, Protocol protocol)` Constructor for HttpHost.
    `HttpHost(URI uri)` URI constructor for HttpHost.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()`
    `boolean` | `equals(java.lang.Object o)`
    `java.lang.String` | `getHostName()` Returns the host name (IP or DNS name).
    `int` | `getPort()` Returns the port.
    `Protocol` | `getProtocol()` Returns the protocol.
    `int` | `hashCode()`
    `java.lang.String` | `toString()`
    `java.lang.String` | `toURI()` Return the host uri.

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpHost

          public HttpHost(java.lang.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(java.lang.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(java.lang.String hostname)

      Constructor for HttpHost.
      Parameters:
        `hostname` - the hostname (IP or DNS name). Can be `null`.

    - #### HttpHost

          public HttpHost(URI uri)
                   throws URIException

      URI constructor for HttpHost.
      Parameters:
        `uri` - the URI.
      Throws:
        `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

      Overrides:
        `clone` in class `java.lang.Object`
      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 `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.

    - #### toURI

          public java.lang.String toURI()

      Return the host uri.
      Returns:
        The host uri.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`
      See Also:
        `Object.toString()`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`
      See Also:
        `Object.equals(java.lang.Object)`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`
      See Also:
        `Object.hashCode()`

Copyright (c) 1999-2005 - Apache Software Foundation