Interface Host

All Superinterfaces:
Normalisable<Host>, org.wiremock.stringparser.ParsedString, PercentEncoded<Host>

public interface Host extends PercentEncoded<Host>, org.wiremock.stringparser.ParsedString
Represents the host component of a URI as defined in RFC 3986 Section 3.2.2.

A host can be an IP address (IPv4 or IPv6), a registered name (domain name), or an IPvFuture address. Registered names may contain percent-encoded characters.

Implementations must be immutable and thread-safe.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Host
     
    static final Host
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Host
    encode(String unencoded)
    Encodes a string into a valid host with proper percent-encoding.
    boolean
    Returns true if this host is in normal form.
    Returns a normalised form of this host.
    static Host
    parse(String hostString)
    Parses a string into a host.

    Methods inherited from interface org.wiremock.stringparser.ParsedString

    toString

    Methods inherited from interface org.wiremock.url.PercentEncoded

    decode, isEmpty, length
  • Field Details

    • EMPTY

      static final Host EMPTY
    • LOCALHOST

      static final Host LOCALHOST
  • Method Details

    • normalise

      Host normalise()
      Returns a normalised form of this host.

      Normalization includes converting registered names to lowercase and normalizing percent-encoding.

      Specified by:
      normalise in interface Normalisable<Host>
      Returns:
      a normalised host
    • parse

      static Host parse(String hostString) throws IllegalHost
      Parses a string into a host.
      Parameters:
      hostString - the string to parse
      Returns:
      the parsed host
      Throws:
      IllegalHost - if the string is not a valid host
    • encode

      static Host encode(String unencoded)
      Encodes a string into a valid host with proper percent-encoding.
      Parameters:
      unencoded - the unencoded string
      Returns:
      the encoded host
    • isNormalForm

      boolean isNormalForm()
      Returns true if this host is in normal form.
      Specified by:
      isNormalForm in interface Normalisable<Host>
      Returns:
      true if this is in normal form