Interface Scheme
- All Superinterfaces:
org.wiremock.stringparser.ParsedString
An implementation must be immutable (and hence threadsafe)
Implementations must enforce that the scheme is valid
Implementations should be equal to any other Scheme implementation with the same text
representation. Implementations are NOT equal to a scheme with different casing - so
Scheme.parse("http").equals(Scheme.parse("HTTP")) == false. However, their canonical
representations are equal, so
Scheme.parse("http").canonical().equals(Scheme.parse("HTTP").canonical()) == true .
An implementation's toString should return the String used when it was created.
-
Method Summary
Modifier and TypeMethodDescription@Nullable Portdefault booleanstatic SchemeParses & registers a schemestatic SchemeRegisters a canonical scheme with no default port.static SchemeRegisters a scheme with an optional default port.default AbsoluteUridefault AbsoluteUrlresolve(UrlWithAuthority other) Methods inherited from interface org.wiremock.stringparser.ParsedString
toString
-
Method Details
-
normalise
Scheme normalise() -
getDefaultPort
@Nullable Port getDefaultPort() -
isNormalForm
default boolean isNormalForm() -
resolve
-
resolve
-
parse
Parses & registers a schemeUnlike register, returns a scheme with the same casing as the scheme param, but
canonical()will return the canonical (lower case) version, which may already have been registered.If the scheme parameter is canonical (lower case), and a matching Scheme with a default port has already been registered, that Scheme will be returned.
- Parameters:
scheme- - the raw scheme- Returns:
- a Scheme object representing the scheme
- Throws:
IllegalScheme- if the raw scheme is not a legal Scheme, matching[a-zA-Z][a-zA-Z0-9+\-.]{0,255}
-
register
Registers a canonical scheme with no default port.The registered and returned scheme will be canonical (i.e. lower case) regardless of the case of the input.
If the scheme is already registered, returns the existing instance with the existing instances default port (or none).
- Parameters:
schemeString- - the raw scheme- Returns:
- a canonical Scheme object representing the scheme
- Throws:
IllegalScheme- if the raw scheme is not a legal Scheme, matching[a-zA-Z][a-zA-Z0-9+\-.]{0,255}
-
register
Registers a scheme with an optional default port.The registered and returned scheme will be canonical (i.e. lower case) regardless of input.
If the scheme is already registered, returns the existing instance and ignores the provided default port.
The returned scheme will be canonical (i.e. lower case)
- Parameters:
schemeString- - the raw scheme- Returns:
- a canonical Scheme object representing the scheme
- Throws:
IllegalScheme- if the raw scheme is not a legal Scheme, matching[a-zA-Z][a-zA-Z0-9+\-.]{0,255}
-