Package io.muserver.rest
Class PathMatch
- java.lang.Object
-
- io.muserver.rest.PathMatch
-
public class PathMatch extends java.lang.ObjectThe 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 PathMatchEMPTY_MATCHAn empty match
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanfullyMatches()java.util.Map<java.lang.String,java.lang.String>params()Returns a mapping of URI names to path params.booleanprefixMatches()java.util.regex.MatcherregexMatcher()java.util.Map<java.lang.String,jakarta.ws.rs.core.PathSegment>segments()Returns a mapping of URI names to path segments.java.lang.StringtoString()
-
-
-
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
/abcthen this will returntruefor/abcand/abc/defetc.
-
fullyMatches
public boolean fullyMatches()
- Returns:
- Returns true if the checked URI matches this pattern. For example
if the pattern is
/abcthen this will returntruefor/abcbut false for/abc/defetc.
-
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 returnorangeif 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,jakarta.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 returnorangeif 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:
toStringin classjava.lang.Object
-
-