Class UriPattern
A URI pattern is an absolute path segment used to route to operations. The pattern must start with "/", must not contain empty segments (i.e., "//"), must not contain a fragment (i.e., "#"), and must not end with "?".
Labels may appear in the pattern in the form of "{label}". Labels must not be repeated, must make up an entire path segment (e.g., "/{foo}/baz"), and the label name must match the regex "^[a-zA-Z0-9_]+$". No labels can appear after the query string.
Greedy labels, a specialized type of label, may be specified using "{label+}". Only a single greedy label may appear in a pattern, and it must be the last label in a pattern.
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.smithy.model.pattern.SmithyPattern
SmithyPattern.Builder, SmithyPattern.Segment
-
Method Summary
Modifier and TypeMethodDescriptionboolean
conflictsWith
(UriPattern otherPattern) Determines if the pattern conflicts with another pattern.boolean
List<software.amazon.smithy.utils.Pair<SmithyPattern.Segment,
SmithyPattern.Segment>> getConflictingLabelSegments
(UriPattern otherPattern) Deprecated.Get an immutable map of query string literal key-value pairs.getQueryLiteralValue
(String parameter) Gets a specific query string literal parameter value.int
hashCode()
static UriPattern
Parse a URI pattern string into a UriPattern.Methods inherited from class software.amazon.smithy.model.pattern.SmithyPattern
builder, getConflictingLabelSegmentsMap, getGreedyLabel, getLabel, getLabels, getSegments, toString
-
Method Details
-
parse
Parse a URI pattern string into a UriPattern.The provided value must match the origin-form request-target grammar production in RFC 7230, section 5.3.1.
- Parameters:
uri
- URI pattern to parse.- Returns:
- Returns the parsed URI pattern.
- Throws:
InvalidUriPatternException
- for invalid URI patterns.- See Also:
-
getQueryLiterals
Get an immutable map of query string literal key-value pairs.- Returns:
- An immutable map of parsed query string literals.
-
getQueryLiteralValue
Gets a specific query string literal parameter value.- Parameters:
parameter
- Case-sensitive name of the parameter to retrieve.- Returns:
- Returns the optionally found parameter value.
-
conflictsWith
Determines if the pattern conflicts with another pattern.- Parameters:
otherPattern
- SmithyPattern to check against.- Returns:
- Returns true if there is a conflict.
-
getConflictingLabelSegments
@Deprecated public List<software.amazon.smithy.utils.Pair<SmithyPattern.Segment,SmithyPattern.Segment>> getConflictingLabelSegments(UriPattern otherPattern) Deprecated. -
equals
- Overrides:
equals
in classSmithyPattern
-
hashCode
public int hashCode()- Overrides:
hashCode
in classSmithyPattern
-