Package org.wiremock.url
Interface Url
- All Superinterfaces:
org.wiremock.stringparser.ParsedString,Uri
- All Known Subinterfaces:
AbsoluteUrl,BaseUrl,Origin,PathAndQuery,RelativeUrl,SchemeRelativeUrl,ServersideAbsoluteUrl,UrlWithAuthority
- All Known Implementing Classes:
BaseUrlValue
Represents a URL reference, which is the subset of URI references that are not full
(absolute) URIs without an authority - what we call
OpaqueUris. The name Url is
used in preference to UrlReference because it is more familiar to developers, who habitually
think of both relative and complete URL references as URLs.
An Url is either an AbsoluteUrl or an RelativeUrl. An AbsoluteUrl is guaranteed to resolve to an AbsoluteUrl if resolved against an Url, whereas it may resolve to an OpaqueUri if resolved against an Uri.
Implementations must be immutable and thread-safe.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfaceUrl.Transformer<SELF extends Url.Transformer<SELF>> -
Method Summary
Modifier and TypeMethodDescriptionstatic Url.Builderbuilder()Creates a new builderstatic Url.BuilderCreates a builder initialized with the values from the given URL.default PathAndQueryReturns the path and query components combined.static UrlParses a string into a URI reference.default Url.Transformer<?>thaw()Creates a transformer initialized with the values from this URL.default Urltransform(Consumer<Uri.Transformer<?>> mutator) Convenience method for transforming a UrlMethods inherited from interface org.wiremock.stringparser.ParsedString
toStringMethods inherited from interface org.wiremock.url.Uri
getAuthority, getFragment, getHost, getPath, getPort, getQuery, getQueryOrEmpty, getResolvedPort, getScheme, getUserInfo, isAbsolute, isAbsoluteUrl, isOpaqueUri, isRelative, toJavaUri
-
Method Details
-
getPathAndQuery
Returns the path and query components combined.- Returns:
- the path and query
-
thaw
Creates a transformer initialized with the values from this URL.- Returns:
- a transformer
-
transform
Convenience method for transforming a Url- Parameters:
mutator- a function to mutate the transformer- Returns:
- the transformed Url
- Throws:
IllegalUrl- if scheme is set and Authority is not setIllegalUri
-
builder
Creates a new builder- 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
-
parse
Parses a string into a URI reference.- Parameters:
url- the string to parse- Returns:
- the parsed URI reference
- Throws:
IllegalUri- if the string is not a valid URI reference
-