Package org.wiremock.url
Interface HostAndPort
- All Superinterfaces:
Authority,Normalisable<Authority>,org.wiremock.stringparser.ParsedString
Represents an authority component consisting of only a host and optional port, with no user info.
This is a specialized form of Authority that is guaranteed to have no user
information. It is commonly used for origins and server identification.
Implementations must be immutable and thread-safe.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault HostAndPortDeprecated.This always returns this so you have no reason to ever call itdefault @Nullable UserInfoDeprecated.This always returns null so you have no reason to ever call itReturns a normalized form of this host and port.Returns a normalized form of this host and port using scheme-specific normalization rules.static HostAndPortCreates a host and port from a host.static HostAndPortCreates a host and port from a host and optional port.static HostAndPortParses a string into a host and port.Returns a new host and port with the specified port.Methods inherited from interface org.wiremock.url.Authority
getHost, getMaybePort, getPort, isNormalForm, isNormalForm, withoutPortMethods inherited from interface org.wiremock.stringparser.ParsedString
toString
-
Field Details
-
EMPTY
-
-
Method Details
-
of
Creates a host and port from a host.- Parameters:
host- the host- Returns:
- the host and port
-
of
Creates a host and port from a host and optional port.- Parameters:
host- the hostport- the port, ornull- Returns:
- the host and port
-
parse
Parses a string into a host and port.- Parameters:
hostAndPortStr- the string to parse- Returns:
- the parsed host and port
- Throws:
IllegalHostAndPort- if the string is not a valid host and portIllegalAuthority- if the string is not a valid authority
-
getUserInfo
Deprecated.This always returns null so you have no reason to ever call itImplementations must ALWAYS return null- Specified by:
getUserInfoin interfaceAuthority- Returns:
- null
-
getHostAndPort
Deprecated.This always returns this so you have no reason to ever call itImplementations must ALWAYS return this- Specified by:
getHostAndPortin interfaceAuthority- Returns:
- this
-
withPort
Returns a new host and port with the specified port. -
normalise
HostAndPort normalise()Returns a normalized form of this host and port.- Specified by:
normalisein interfaceNormalisable<Authority>- Returns:
- a normalized host and port
-
normalise
Returns a normalized form of this host and port using scheme-specific normalization rules.
-