| Modifier and Type | Method and Description |
|---|---|
Route |
build()
Returns a newly-created
Route based on the properties of this builder. |
RouteBuilder |
catchAll()
Sets the
Route to match any path. |
RouteBuilder |
consumes(Iterable<MediaType> consumeTypes)
|
RouteBuilder |
consumes(MediaType... consumeTypes)
|
boolean |
equals(Object o) |
RouteBuilder |
exact(String exactPath)
Sets the
Route to match the specified exact path. |
RouteBuilder |
glob(String glob)
Sets the
Route to match the specified glob. |
int |
hashCode() |
RouteBuilder |
matchesHeaders(CharSequence headerName,
Predicate<? super String> valuePredicate)
Sets the
Route to accept a request when the specified valuePredicate evaluates
true with the value of the specified headerName header. |
RouteBuilder |
matchesHeaders(Iterable<String> headerPredicates)
Sets the
Route to accept a request if it matches all the specified predicates for
HttpHeaders. |
RouteBuilder |
matchesHeaders(String... headerPredicates)
Sets the
Route to accept a request if it matches all the specified predicates for
HttpHeaders. |
RouteBuilder |
matchesParams(Iterable<String> paramPredicates)
Sets the
Route to accept a request if it matches all the specified predicates for
HTTP parameters. |
RouteBuilder |
matchesParams(String... paramPredicates)
Sets the
Route to accept a request if it matches all the specified predicates for
HTTP parameters. |
RouteBuilder |
matchesParams(String paramName,
Predicate<? super String> valuePredicate)
Sets the
Route to accept a request when the specified valuePredicate evaluates
true with the value of the specified paramName parameter. |
RouteBuilder |
methods(HttpMethod... methods)
Sets the
Route to support the specified HttpMethods. |
RouteBuilder |
methods(Iterable<HttpMethod> methods)
Sets the
Route to support the specified HttpMethods. |
RouteBuilder |
path(String pathPattern)
Sets the
Route to match the specified pathPattern. e.g. |
RouteBuilder |
path(String prefix,
String pathPattern)
|
RouteBuilder |
pathPrefix(String prefix)
|
RouteBuilder |
pathPrefix(String prefix,
boolean stripPrefix)
|
RouteBuilder |
pathWithPrefix(String prefix,
String pathPattern)
Deprecated.
|
RouteBuilder |
prefix(String prefix)
Deprecated.
|
RouteBuilder |
prefix(String prefix,
boolean stripPrefix)
Deprecated.
|
RouteBuilder |
produces(Iterable<MediaType> produceTypes)
|
RouteBuilder |
produces(MediaType... produceTypes)
|
RouteBuilder |
regex(Pattern regex)
Sets the
Route to match the specified regex. |
RouteBuilder |
regex(String regex)
Sets the
Route to match the specified regex. |
String |
toString() |
public RouteBuilder path(String pathPattern)
Route to match the specified pathPattern. e.g.
/login (no path parameters)/users/{userId} (curly-brace style)/list/:productType/by/:ordering (colon style)exact:/foo/bar (exact match)prefix:/files (prefix match)glob:/~*/downloads/** (glob pattern)regex:^/files/(?<filePath>.*)$ (regular expression)IllegalArgumentException - if the specified path pattern is invalidpublic RouteBuilder path(String prefix, String pathPattern)
Route to match the specified prefix and pathPattern. The mapped
HttpService is found when a path is under
the specified prefix and the rest of the path matches the specified pathPattern.path(String)public RouteBuilder exact(String exactPath)
Route to match the specified exact path.@Deprecated public RouteBuilder prefix(String prefix)
pathPrefix(String)Route to match when a path is under the
specified prefix. It also removes the specified prefix from the matched path so that
mappedPath does not have the specified prefix.
For example, when prefix is "/foo/":
"/foo/" translates to "/""/foo/bar" translates to "/bar""/foo/bar/baz" translates to "/bar/baz"@Deprecated public RouteBuilder prefix(String prefix, boolean stripPrefix)
pathPrefix(String, boolean)Route to match when a path is under the
specified prefix. When stripPrefix is true, it also removes the specified
prefix from the matched path so that mappedPath
does not have the specified prefix. For example, when prefix is "/foo/":
"/foo/" translates to "/""/foo/bar" translates to "/bar""/foo/bar/baz" translates to "/bar/baz"public RouteBuilder pathPrefix(String prefix)
Route to match when a path is under the
specified prefix. It also removes the specified prefix from the matched path so that
mappedPath does not have the specified prefix.
For example, when prefix is "/foo/":
"/foo/" translates to "/""/foo/bar" translates to "/bar""/foo/bar/baz" translates to "/bar/baz"public RouteBuilder pathPrefix(String prefix, boolean stripPrefix)
Route to match when a path is under the
specified prefix. When stripPrefix is true, it also removes the specified
prefix from the matched path so that mappedPath
does not have the specified prefix. For example, when prefix is "/foo/":
"/foo/" translates to "/""/foo/bar" translates to "/bar""/foo/bar/baz" translates to "/bar/baz"public RouteBuilder catchAll()
Route to match any path.public RouteBuilder glob(String glob)
Route to match the specified glob.
"*" in the expression matches a path component non-recursively whereas "**" matches
path components recursively.public RouteBuilder regex(String regex)
Route to match the specified regex. It also extracts
the values of the named groups to pathParams:
e.g. "^/users/(?<userId>[0-9]+)$" will extract the second numeric part of the path into
the "userId" path parameter.public RouteBuilder regex(Pattern regex)
Route to match the specified regex. It also extracts
the values of the named groups to pathParams:
e.g. "^/users/(?<userId>[0-9]+)$" will extract the second numeric part of the path into
the "userId" path parameter.@Deprecated public RouteBuilder pathWithPrefix(String prefix, String pathPattern)
Route to match the specified prefix and pathPattern. The mapped
HttpService is found when a path is under
the specified prefix and the rest of the path matches the specified pathPattern.public RouteBuilder methods(HttpMethod... methods)
Route to support the specified HttpMethods. If not set,
the mapped HttpService accepts any HttpMethods.public RouteBuilder methods(Iterable<HttpMethod> methods)
Route to support the specified HttpMethods. If not set,
the mapped HttpService accepts any HttpMethods.public RouteBuilder consumes(MediaType... consumeTypes)
Route to consume the specified MediaTypes. If not set,
the mapped HttpService accepts HttpRequests that have any
HttpHeaderNames.CONTENT_TYPE. In order to get this work, methods(Iterable) must be set.public RouteBuilder consumes(Iterable<MediaType> consumeTypes)
Route to consume the specified MediaTypes. If not set,
the mapped HttpService accepts HttpRequests that have any
HttpHeaderNames.CONTENT_TYPE. In order to get this work, methods(Iterable) must be set.public RouteBuilder produces(MediaType... produceTypes)
Route to produce the specified MediaTypes. If not set,
the mapped HttpService accepts HttpRequests that have any
HttpHeaderNames.ACCEPT. In order to get this work, methods(Iterable) must be set.public RouteBuilder produces(Iterable<MediaType> produceTypes)
Route to produce the specified MediaTypes. If not set,
the mapped HttpService accepts HttpRequests that have any
HttpHeaderNames.ACCEPT. In order to get this work, methods(Iterable) must be set.public RouteBuilder matchesParams(String... paramPredicates)
Route to accept a request if it matches all the specified predicates for
HTTP parameters. The predicate can be one of the following forms:
some-param=some-value which means that the request must have a
some-param=some-value parametersome-param!=some-value which means that the request must not have a
some-param=some-value parametersome-param which means that the request must contain a some-param parameter!some-param which means that the request must not contain a some-param
parameterNote that these predicates can be evaluated only with the query string of the request URI. Also note that each predicate will be evaluated with the decoded value of HTTP parameters, so do not use percent-encoded value in the predicate.
MatchesParampublic RouteBuilder matchesParams(Iterable<String> paramPredicates)
Route to accept a request if it matches all the specified predicates for
HTTP parameters. The predicate can be one of the following forms:
some-param=some-value which means that the request must have a
some-param=some-value parametersome-param!=some-value which means that the request must not have a
some-param=some-value parametersome-param which means that the request must contain a some-param parameter!some-param which means that the request must not contain a some-param
parameterNote that these predicates can be evaluated only with the query string of the request URI. Also note that each predicate will be evaluated with the decoded value of HTTP parameters, so do not use percent-encoded value in the predicate.
MatchesParampublic RouteBuilder matchesParams(String paramName, Predicate<? super String> valuePredicate)
Route to accept a request when the specified valuePredicate evaluates
true with the value of the specified paramName parameter.public RouteBuilder matchesHeaders(String... headerPredicates)
Route to accept a request if it matches all the specified predicates for
HttpHeaders. The predicate can be one of the following forms:
some-header=some-value which means that the request must have a
some-header: some-value headersome-header!=some-value which means that the request must not have a
some-header: some-value headersome-header which means that the request must contain a some-header header!some-header which means that the request must not contain a some-header
headerMatchesHeaderpublic RouteBuilder matchesHeaders(Iterable<String> headerPredicates)
Route to accept a request if it matches all the specified predicates for
HttpHeaders. The predicate can be one of the following forms:
some-header=some-value which means that the request must have a
some-header: some-value headersome-header!=some-value which means that the request must not have a
some-header: some-value an headersome-header which means that the request must contain a some-header header!some-header which means that the request must not contain a some-header
headerMatchesHeaderpublic RouteBuilder matchesHeaders(CharSequence headerName, Predicate<? super String> valuePredicate)
Route to accept a request when the specified valuePredicate evaluates
true with the value of the specified headerName header.Copyright © 2020 LeanCloud. All rights reserved.