Package org.wiremock.url
Interface AbsoluteUrl
- All Superinterfaces:
AbsoluteUri,Normalisable<AbsoluteUri>,org.wiremock.stringparser.ParsedString,Uri,Url,UrlWithAuthority
- All Known Subinterfaces:
BaseUrl,Origin,ServersideAbsoluteUrl
- All Known Implementing Classes:
BaseUrlValue
Represents a Uniform Resource Locator (URL) as defined in RFC 3986. The name
AbsoluteUrl
is used in preference to Url because it is more familiar to developers, who habitually think of
both relative and complete URL references as URLs and use absolute URL to mean the latter. Note
that this is not an absolute URL in the RFC 3986 sense of a complete URI with no fragment.
An AbsoluteUrl consists of a scheme, authority (host and optional port and user info),
path, optional query, and optional fragment. AbsoluteUrls always have both a scheme and
an authority component.
Implementations must be immutable and thread-safe.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptionstatic AbsoluteUrl.Builderbuilder(AbsoluteUrl url) Creates a builder initialized with the values from the given URL.static AbsoluteUrl.BuilderCreates a new builder with the given scheme and authority.Returns the authority component of this URL.default HostgetHost()Returns the host component from the authority, ornullif there is no authority.default OriginReturns the origin of this URL, consisting of the scheme, host, and port.default SchemeRelativeUrldefault ServersideAbsoluteUrlReturns the serverside absolute URL of this URL, this URL without a fragmentdefault booleanReturnstrueif this is an absolute URL (has a scheme and authority).default booleanReturnstrueif this is an Opaque URI (has a scheme but no authority).default booleanReturnstrueif this is a relative reference (has no scheme).Returns a normalised form of this URL.static AbsoluteUrlParses a string into a URL.default AbsoluteUrlResolves the given string as a URI reference against this URL.default AbsoluteUrlResolves the given path against this URL.default AbsoluteUrlResolves the given URL reference against this URL.default AbsoluteUrl.Transformerthaw()Creates a builder initialized with the values from this URL.default BaseUrlReturns this URL as a base URL, by removing the query and fragment and ensuring the path is either empty or ends with /default AbsoluteUrltransform(Consumer<Uri.Transformer<?>> mutator) Transforms this URL by applying modifications via a transformer.Methods inherited from interface org.wiremock.url.AbsoluteUri
getScheme, isAbsolute, isNormalForm, resolve, resolveMethods inherited from interface org.wiremock.stringparser.ParsedString
toStringMethods inherited from interface org.wiremock.url.Uri
getFragment, getPath, getPort, getQuery, getQueryOrEmpty, getResolvedPort, getUserInfo, toJavaUriMethods inherited from interface org.wiremock.url.Url
getPathAndQuery
-
Method Details
-
getAuthority
Authority getAuthority()Returns the authority component of this URL.URLs always have an authority component (unlike relative references and URNs).
- Specified by:
getAuthorityin interfaceUri- Specified by:
getAuthorityin interfaceUrlWithAuthority- Returns:
- the authority component, never
null
-
isRelative
default boolean isRelative()Description copied from interface:UriReturnstrueif this is a relative reference (has no scheme).- Specified by:
isRelativein interfaceAbsoluteUri- Specified by:
isRelativein interfaceUri- Returns:
trueif this is a relative reference
-
isAbsoluteUrl
default boolean isAbsoluteUrl()Description copied from interface:UriReturnstrueif this is an absolute URL (has a scheme and authority).- Specified by:
isAbsoluteUrlin interfaceUri- Returns:
trueif this is an absolute URL
-
isOpaqueUri
default boolean isOpaqueUri()Description copied from interface:UriReturnstrueif this is an Opaque URI (has a scheme but no authority).- Specified by:
isOpaqueUriin interfaceUri- Returns:
trueif this is an Opaque URI
-
getHost
Description copied from interface:UriReturns the host component from the authority, ornullif there is no authority. -
getOrigin
Returns the origin of this URL, consisting of the scheme, host, and port.- Returns:
- the origin
-
getServersideAbsoluteUrl
Returns the serverside absolute URL of this URL, this URL without a fragment- Returns:
- the origin
-
toBaseUrl
Returns this URL as a base URL, by removing the query and fragment and ensuring the path is either empty or ends with /- Returns:
- the origin
-
getSchemeRelativeUrl
- Specified by:
getSchemeRelativeUrlin interfaceUrlWithAuthority
-
normalise
AbsoluteUrl normalise()Returns a normalised form of this URL.- Specified by:
normalisein interfaceAbsoluteUri- Specified by:
normalisein interfaceNormalisable<AbsoluteUri>- Returns:
- a normalised URL
-
resolve
Resolves the given string as a URI reference against this URL.- Parameters:
other- the URL to resolve- Returns:
- the resolved absolute URL
- Throws:
IllegalUrl- if the other is not a valid URL
-
resolve
Resolves the given path against this URL.- Specified by:
resolvein interfaceAbsoluteUri- Parameters:
other- the path to resolve- Returns:
- the URL with the resolved path
-
resolve
Resolves the given URL reference against this URL.- Parameters:
other- the URL reference to resolve- Returns:
- the resolved URL
-
thaw
Creates a builder initialized with the values from this URL.- Specified by:
thawin interfaceAbsoluteUri- Specified by:
thawin interfaceUrl- Returns:
- a builder
-
transform
Transforms this URL by applying modifications via a transformer.- Specified by:
transformin interfaceAbsoluteUri- Specified by:
transformin interfaceUrl- Parameters:
mutator- a function that modifies the transformer- Returns:
- the transformed URL
-
parse
Parses a string into a URL.- Parameters:
url- the string to parse- Returns:
- the parsed URL
- Throws:
IllegalAbsoluteUrl- if the string is not a valid URL
-
builder
Creates a new builder with the given scheme and authority.- Parameters:
scheme- the schemeauthority- the authority- Returns:
- a new builder
-
builder
Creates a builder initialized with the values from the given URL.- Parameters:
url- the URL to copy values from- Returns:
- a new builder
-