| 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 |
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.Copyright © 2020 LeanCloud. All rights reserved.