public class HostPort
extends java.lang.Object
Parse a string in the form "host:port", handling IPv4 an IPv6 hosts
The System property "org.eclipse.jetty.util.HostPort.STRIP_IPV6" can be set to a boolean value to control of the square brackets are stripped off IPv6 addresses (default false).
Constructor and Description |
---|
HostPort(java.lang.String authority) |
HostPort(java.lang.String host,
int port) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getHost()
Get the host.
|
int |
getPort()
Get the port.
|
int |
getPort(int defaultPort)
Get the port.
|
static java.lang.String |
normalizeHost(java.lang.String host)
Normalize IPv6 address as per https://www.ietf.org/rfc/rfc2732.txt
|
java.lang.String |
toString() |
public HostPort(java.lang.String host, int port) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public HostPort(java.lang.String authority) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public java.lang.String getHost()
public int getPort()
public int getPort(int defaultPort)
defaultPort,
- the default port to return if a port is not specifiedpublic java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String normalizeHost(java.lang.String host)
host
- A host nameCopyright © 1995–2023 Webtide. All rights reserved.