io.vertx.core.net

## Interface HostAndPort

-     public interface HostAndPort

  A combination of host and port.

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static HostAndPort` | `authority(String host)` Like `authority(String, int)` without a port, `-1` is used instead.
    `static HostAndPort` | `authority(String host, int port)` Create an instance with a valid `host` for a valid authority: the `host` must match the host rule of rfc3986.
    `static HostAndPort` | `create(String host, int port)` Create an arbitrary instance.
    `String` | `host()`
    `static HostAndPort` | `parseAuthority(String string, int schemePort)` Parse an authority HTTP header, that is host [':' port], according to rfc3986.
    `int` | `port()`

- - ### Method Detail

    - #### create

          static HostAndPort create(String host,
                                    int port)

      Create an arbitrary instance.
      Parameters:
        `host` - the host value
        `port` - the port value
      Returns:
        the instance.

    - #### parseAuthority

          static HostAndPort parseAuthority(String string,
                                            int schemePort)

      Parse an authority HTTP header, that is host [':' port], according to rfc3986.
      Parameters:
        `string` - the string to parse
        `schemePort` - the scheme port used when the optional port is not specified
      Returns:
        the parsed authority or `null` when the `string` does not represent a valid authority.

    - #### authority

          static HostAndPort authority(String host,
                                       int port)

      Create an instance with a valid `host` for a valid authority: the `host` must match the host rule of rfc3986.
      Parameters:
        `host` - the host portion
        `port` - the port
      Returns:
        the instance

    - #### authority

          static HostAndPort authority(String host)

      Like `authority(String, int)` without a port, `-1` is used instead.

    - #### host

          String host()

      Returns:
        the host value

    - #### port

          int port()

      Returns:
        the port value or `-1` when not specified

Copyright © 2025 Eclipse. All rights reserved.