Class HostValidator

java.lang.Object
io.helidon.http.HostValidator

public final class HostValidator extends Object
Validate the host string (maybe from the Host header).

Validation is based on RFC-3986.

  • Method Details

    • validate

      public static void validate(String host)
      Validate a host string.
      Parameters:
      host - host to validate
      Throws:
      IllegalArgumentException - in case the host is not valid, the message is HTML encoded
    • validateIpLiteral

      public static void validateIpLiteral(String ipLiteral)
      An IP literal starts with [ and ends with ].
      Parameters:
      ipLiteral - host literal string, may be an IPv6 address, or IP version future
      Throws:
      IllegalArgumentException - in case the host is not valid, the message is HTML encoded
    • validateNonIpLiteral

      public static void validateNonIpLiteral(String host)
      Validate IPv4 address or a registered name.
      Parameters:
      host - string with either an IPv4 address, or a registered name
      Throws:
      IllegalArgumentException - in case the host is not valid, the message is HTML encoded