public interface PathMatcher
Routing implementation.
Matched URI path is always decoded, normalized and
with removed single ended slash (if any).
from(String) factory method. The method accepts Web Server Path Pattern format.
| Construct Example | Description |
|---|---|
/foo/bar/b,a+z |
Exact canonical path match. (Including decoded characters.) |
/foo/{var} |
Named regular expression segment.
Name is var and regexp segment is ([^/]+). Use PathMatcher.Result.param(String) method to get value
of the segment. |
/foo/{} |
Nameless regular expression segment. Regexp segment is ([^/]+) |
/foo/{var:\d+} |
Named regular expression segment with specified expression. |
/foo/{:\d+} |
Nameless regular expression segment with specified expression. |
/foo/{+var} |
A convenience shortcut for /foo/{var:.+}. |
/foo/{+} |
A convenience shortcut for /foo/{:.+}. |
/foo[/bar] |
A optional section. Translated to regexp: /foo(/bar)? |
| Modifier and Type | Interface | Description |
|---|---|---|
static interface |
PathMatcher.PrefixResult |
The result of prefix matching a
PathMatcher to a given URI path. |
static interface |
PathMatcher.Result |
The result of matching a
PathMatcher to a given URI path. |
| Modifier and Type | Method | Description |
|---|---|---|
static PathMatcher |
from(java.lang.String pathPattern) |
Creates new instance from provided Web Server path pattern.
|
PathMatcher.Result |
match(java.lang.CharSequence path) |
Matches this matcher against a URI path.
|
PathMatcher.PrefixResult |
prefixMatch(java.lang.CharSequence path) |
Matches this matcher against a left part (prefix) of URI path with granularity on the path segment.
|
static PathMatcher from(java.lang.String pathPattern) throws java.lang.NullPointerException, IllegalPathPatternException
pathPattern - Web Server path pattern.java.lang.NullPointerException - if parameter pathPattern is null.IllegalPathPatternException - if provided pattern is not valid Web Server path pattern.PathMatcher.Result match(java.lang.CharSequence path)
path - resolved and normalized URI path to test against.PathMatcher.Result of the test.java.lang.NullPointerException - in case that path parameter is null.PathMatcher.PrefixResult prefixMatch(java.lang.CharSequence path)
path - resolved and normalized URI path to test against.PathMatcher.Result of the test.java.lang.NullPointerException - in case that path parameter is null.Copyright © 2018 Oracle Corporation. All rights reserved.