Package io.micronaut.http.uri
Class UriMatchTemplate
java.lang.Object
io.micronaut.http.uri.UriTemplate
io.micronaut.http.uri.UriMatchTemplate
- All Implemented Interfaces:
UriMatcher
,Comparable<UriTemplate>
- Direct Known Subclasses:
UriTypeMatchTemplate
Extends
UriTemplate
and adds the ability to match a URI to a given template using the
UriMatcher.match(java.net.URI)
method.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
The defaultUriMatchInfo
implementation.protected static class
Extended version ofUriTemplate.UriTemplateParser
that builds a regular expression to match a path.Nested classes/interfaces inherited from class io.micronaut.http.uri.UriTemplate
UriTemplate.PathSegment, UriTemplate.UriTemplateParser
-
Field Summary
Modifier and TypeFieldDescriptionprotected StringBuilder
protected static final String
protected List<UriMatchVariable>
Fields inherited from class io.micronaut.http.uri.UriTemplate
templateString
-
Constructor Summary
ModifierConstructorDescriptionUriMatchTemplate
(CharSequence templateString) Construct a new URI template for the given template.protected
UriMatchTemplate
(CharSequence templateString, Object... parserArguments) Construct a new URI template for the given template.protected
UriMatchTemplate
(CharSequence templateString, List<UriTemplate.PathSegment> segments, Pattern matchPattern, List<UriMatchVariable> variables) -
Method Summary
Modifier and TypeMethodDescriptionprotected UriTemplate.UriTemplateParser
createParser
(String templateString, Object... parserArguments) Creates a parser.Match the given URI string.nest
(CharSequence uriTemplate) Nests another URI template with this template.protected UriMatchTemplate
newUriMatchTemplate
(CharSequence uriTemplate, List<UriTemplate.PathSegment> newSegments, Pattern newPattern, List<UriMatchVariable> variables) protected UriTemplate
newUriTemplate
(CharSequence uriTemplate, List<UriTemplate.PathSegment> newSegments) static UriMatchTemplate
Create a newUriTemplate
for the given URI.Returns the path string excluding any query variables.Match the given URI string.Methods inherited from class io.micronaut.http.uri.UriTemplate
buildNestedSegments, compareTo, equals, expand, expand, getPathVariableSegmentCount, getRawSegmentCount, getRawSegmentLength, getTemplateString, getVariableSegmentCount, hashCode, nest, normalizeNested, toString, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.micronaut.http.uri.UriMatcher
match
-
Field Details
-
VARIABLE_MATCH_PATTERN
- See Also:
-
pattern
-
variables
-
-
Constructor Details
-
UriMatchTemplate
Construct a new URI template for the given template.- Parameters:
templateString
- The template string
-
UriMatchTemplate
Construct a new URI template for the given template.- Parameters:
templateString
- The template stringparserArguments
- The parsed arguments
-
UriMatchTemplate
protected UriMatchTemplate(CharSequence templateString, List<UriTemplate.PathSegment> segments, Pattern matchPattern, List<UriMatchVariable> variables) - Parameters:
templateString
- The templatesegments
- The list of segmentsmatchPattern
- The match patternvariables
- The variables
-
-
Method Details
-
newUriMatchTemplate
protected UriMatchTemplate newUriMatchTemplate(CharSequence uriTemplate, List<UriTemplate.PathSegment> newSegments, Pattern newPattern, List<UriMatchVariable> variables) - Parameters:
uriTemplate
- The templatenewSegments
- The list of new segmentsnewPattern
- The list of new pattersvariables
- The variables- Returns:
- An instance of
UriMatchTemplate
-
getVariableNames
- Returns:
- The variables this template expects
-
getVariables
- Returns:
- The variables this template expects
-
toPathString
Returns the path string excluding any query variables.- Returns:
- The path string
-
match
Match the given URI string.- Specified by:
match
in interfaceUriMatcher
- Parameters:
uri
- The uRI- Returns:
- an optional match
-
tryMatch
Match the given URI string.- Parameters:
uri
- The uRI- Returns:
- a match or null
-
nest
Description copied from class:UriTemplate
Nests another URI template with this template.- Overrides:
nest
in classUriTemplate
- Parameters:
uriTemplate
- The URI template. If it does not begin with forward slash it will automatically be appended with forward slash- Returns:
- The new URI template
-
of
Create a newUriTemplate
for the given URI.- Parameters:
uri
- The URI- Returns:
- The template
-
newUriTemplate
protected UriTemplate newUriTemplate(CharSequence uriTemplate, List<UriTemplate.PathSegment> newSegments) - Overrides:
newUriTemplate
in classUriTemplate
- Parameters:
uriTemplate
- The URI templatenewSegments
- The new segments- Returns:
- The new
UriTemplate
-
createParser
protected UriTemplate.UriTemplateParser createParser(String templateString, Object... parserArguments) Description copied from class:UriTemplate
Creates a parser.- Overrides:
createParser
in classUriTemplate
- Parameters:
templateString
- The templateparserArguments
- The parsed arguments- Returns:
- The created parser
-