public class UriPattern extends Object
/fruit
or /fruit/{name}
etc.
To create a new pattern, call the static uriTemplateToRegex(String)
method.Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
PathMatch |
matcher(String rawPath)
Matches the given raw path against this pattern.
|
PathMatch |
matcher(URI input)
Matches the given URI against this pattern.
|
List<String> |
namedGroups() |
String |
pattern() |
String |
toString() |
static UriPattern |
uriTemplateToRegex(String template)
Converts a URI Template to a regular expression, following the
JAX-RS:
Java™ API for RESTful Web Services specification Version 2.0 section
3.7.3 |
public String pattern()
public List<String> namedGroups()
public PathMatch matcher(URI input)
input
- The URI to check against.PathMatch
where PathMatch.prefixMatches()
is true
if the URI matches
and otherwise false
.public PathMatch matcher(String rawPath)
rawPath
- The URL-encoded path to match, for example /example/some%20path
PathMatch
where PathMatch.prefixMatches()
is true
if the URI matches
and otherwise false
.public static UriPattern uriTemplateToRegex(String template) throws IllegalArgumentException
3.7.3
template
- A string as passed to a Path
annotation, such as /fruit/{name}
/\Qfruit\E/(?<name>[ˆ/]+?)(/.*)?
IllegalArgumentException
- If the template contains invalid regular expression, or template is null, or other errorsCopyright © 2017–2019. All rights reserved.