Class HostPort

java.lang.Object
org.eclipse.jetty.util.HostPort

@Deprecated(since="2021-05-27") public class HostPort extends Object
Deprecated.
The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.

Parse an authority string (in the form host:port) into host and port, handling IPv4 and IPv6 host formats as defined in https://www.ietf.org/rfc/rfc2732.txt

  • Constructor Summary

    Constructors
    Constructor
    Description
    HostPort(String authority)
    Deprecated.
     
    HostPort(String host, int port)
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    Get the host.
    int
    Deprecated.
    Get the port.
    int
    getPort(int defaultPort)
    Deprecated.
    Get the port or the given default port.
    boolean
    Deprecated.
     
    boolean
    Deprecated.
     
    static String
    Deprecated.
    Normalizes IPv6 address as per https://tools.ietf.org/html/rfc2732 and https://tools.ietf.org/html/rfc6874, surrounding with square brackets if they are absent.
    static int
    parsePort(String rawPort)
    Deprecated.
    Parse a string representing a port validating it is a valid port value.
    Deprecated.
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • getHost

      @ManagedAttribute("host") public String getHost()
      Deprecated.
      Get the host.
      Returns:
      the host
    • getPort

      @ManagedAttribute("port") public int getPort()
      Deprecated.
      Get the port.
      Returns:
      the port
    • getPort

      public int getPort(int defaultPort)
      Deprecated.
      Get the port or the given default port.
      Parameters:
      defaultPort - , the default port to return if a port is not specified
      Returns:
      the port
    • hasHost

      public boolean hasHost()
      Deprecated.
    • hasPort

      public boolean hasPort()
      Deprecated.
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object
    • normalizeHost

      public static String normalizeHost(String host)
      Deprecated.
      Normalizes IPv6 address as per https://tools.ietf.org/html/rfc2732 and https://tools.ietf.org/html/rfc6874, surrounding with square brackets if they are absent.
      Parameters:
      host - a host name, IPv4 address, IPv6 address or IPv6 literal
      Returns:
      a host name or an IPv4 address or an IPv6 literal (not an IPv6 address)
    • parsePort

      public static int parsePort(String rawPort) throws IllegalArgumentException
      Deprecated.
      Parse a string representing a port validating it is a valid port value.
      Parameters:
      rawPort - the port string.
      Returns:
      the integer value for the port.
      Throws:
      IllegalArgumentException - if the port is invalid