Class Host

java.lang.Object
akka.http.javadsl.model.Host
Direct Known Subclasses:
Uri.Host

public abstract class Host extends Object
Represents a host in a URI or a Host header. The host can either be empty or be represented by an IPv4 or IPv6 address or by a host name.
  • Field Details

    • EMPTY

      public static final Host EMPTY
      The constant representing an empty Host.
  • Constructor Details

    • Host

      public Host()
  • Method Details

    • address

      public abstract String address()
      Returns a String representation of the address.
    • isEmpty

      public abstract boolean isEmpty()
    • isIPv4

      public abstract boolean isIPv4()
    • isIPv6

      public abstract boolean isIPv6()
    • isNamedHost

      public abstract boolean isNamedHost()
    • getInetAddresses

      public abstract Iterable<InetAddress> getInetAddresses()
      Returns an Iterable of InetAddresses represented by this Host. If this Host is empty the returned Iterable will be empty. If this is an IP address the Iterable will contain this address. If this Host is represented by a host name, the name will be looked up and return all found addresses for this name.
    • create

      public static Host create(String string)
      Parse the given Host string using the default charset and parsing-mode.
    • create

      public static Host create(String string, Uri.ParsingMode parsingMode)
      Parse the given Host string using the given charset and the default parsing-mode.
    • create

      public static Host create(String string, Charset charset, Uri.ParsingMode parsingMode)
      Parse the given Host string using the given charset and parsing-mode.