org.apache.hc.core5.net

## Class URIAuthority

- java.lang.Object
- - org.apache.hc.core5.net.URIAuthority

- All Implemented Interfaces:
    Serializable, NamedEndpoint

      @Contract(threading=IMMUTABLE)
      public final class URIAuthority
      extends Object
      implements NamedEndpoint, Serializable

  Represents authority component of request `URI`.
  Since:
    5.0
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `URIAuthority(Host host)`
    `URIAuthority(NamedEndpoint namedEndpoint)`
    `URIAuthority(String hostname)`
    `URIAuthority(String userInfo, Host host)`
    `URIAuthority(String hostname, int port)`
    `URIAuthority(String userInfo, NamedEndpoint endpoint)`
    `URIAuthority(String userInfo, String hostname, int port)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static URIAuthority` | `create(String s)` Creates `URIHost` instance from string.
    `boolean` | `equals(Object obj)`
    `String` | `getHostName()` Returns name (IP or DNS name).
    `int` | `getPort()` Returns the port.
    `String` | `getUserInfo()`
    `int` | `hashCode()`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### URIAuthority

          public URIAuthority(String userInfo,
                              String hostname,
                              int port)

      Throws:
        `IllegalArgumentException` - If the port parameter is outside the specified range of valid port values, which is between 0 and 65535, inclusive. `-1` indicates the scheme default port.

    - #### URIAuthority

          public URIAuthority(String hostname,
                              int port)

    - #### URIAuthority

          public URIAuthority(String userInfo,
                              Host host)

      Since:
        5.2

    - #### URIAuthority

          public URIAuthority(Host host)

      Since:
        5.2

    - #### URIAuthority

          public URIAuthority(String userInfo,
                              NamedEndpoint endpoint)

      Since:
        5.2

    - #### URIAuthority

          public URIAuthority(NamedEndpoint namedEndpoint)

    - #### URIAuthority

          public URIAuthority(String hostname)

  - ### Method Detail

    - #### create

          public static URIAuthority create(String s)
                                     throws URISyntaxException

      Creates `URIHost` instance from string. Text may not contain any blanks.
      Throws:
        `URISyntaxException`

    - #### getUserInfo

          public String getUserInfo()

    - #### getHostName

          public String getHostName()

      Description copied from interface: `NamedEndpoint`
      Returns name (IP or DNS name).
      Specified by:
        `getHostName` in interface `NamedEndpoint`
      Returns:
        the host name (IP or DNS name)

    - #### getPort

          public int getPort()

      Description copied from interface: `NamedEndpoint`
      Returns the port.
      Specified by:
        `getPort` in interface `NamedEndpoint`
      Returns:
        the host port, or `-1` if not set

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.