Package io.muserver.rest
Class PathMatch
- java.lang.Object
-
- io.muserver.rest.PathMatch
-
public class PathMatch extends java.lang.Object
The result of matching a template URI against a real request URI. If there is a match, then any path parameters are available in theparams()
map.
-
-
Field Summary
Fields Modifier and Type Field Description static PathMatch
EMPTY_MATCH
An empty match
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
fullyMatches()
java.util.Map<java.lang.String,java.lang.String>
params()
Returns a mapping of URI names to path params.boolean
prefixMatches()
java.util.regex.Matcher
regexMatcher()
java.util.Map<java.lang.String,javax.ws.rs.core.PathSegment>
segments()
Returns a mapping of URI names to path segments.java.lang.String
toString()
-
-
-
Field Detail
-
EMPTY_MATCH
public static final PathMatch EMPTY_MATCH
An empty match
-
-
Method Detail
-
prefixMatches
public boolean prefixMatches()
- Returns:
- Returns true if the beginning of the checked URI matches this pattern. For example
if the pattern is
/abc
then this will returntrue
for/abc
and/abc/def
etc.
-
fullyMatches
public boolean fullyMatches()
- Returns:
- Returns true if the checked URI matches this pattern. For example
if the pattern is
/abc
then this will returntrue
for/abc
but false for/abc/def
etc.
-
params
public java.util.Map<java.lang.String,java.lang.String> params()
Returns a mapping of URI names to path params. For example the template URI is/fruit/{name}
thenpathMatch.params().get("name")
will returnorange
if the URI was/fruit/orange
- Returns:
- Returns a read-only map of path parameters names to values.
-
segments
public java.util.Map<java.lang.String,javax.ws.rs.core.PathSegment> segments()
Returns a mapping of URI names to path segments. For example the template URI is/fruit/{name}
thenpathMatch.params().get("name").getPath()
will returnorange
if the URI was/fruit/orange
.The segments also contain matrix parameter info.
- Returns:
- Returns a read-only map of path parameters names to values.
-
regexMatcher
public java.util.regex.Matcher regexMatcher()
- Returns:
- Returns the regex Matcher that was used
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-