public interface Route
Modifier and Type | Method and Description |
---|---|
Route |
blockingHandler(Handler<RoutingContext> requestHandler)
Like
blockingHandler(Handler, boolean) called with ordered = true |
Route |
blockingHandler(Handler<RoutingContext> requestHandler,
boolean ordered)
Specify a blocking request handler for the route.
|
Route |
consumes(String contentType)
Add a content type consumed by this route.
|
Route |
disable()
Disable this route.
|
Route |
enable()
Enable this route.
|
Route |
failureHandler(Handler<RoutingContext> failureHandler)
Append a failure handler to the route failure handlers list.
|
String |
getPath() |
Route |
handler(Handler<RoutingContext> requestHandler)
Append a request handler to the route handlers list.
|
boolean |
isRegexPath()
Returns true of the path is a regular expression, this includes expression paths.
|
Route |
last()
Specify this is the last route for the router.
|
Route |
method(HttpMethod method)
Add an HTTP method for this route.
|
Set<HttpMethod> |
methods() |
Route |
order(int order)
Specify the order for this route.
|
Route |
path(String path)
Set the path prefix for this route.
|
Route |
pathRegex(String path)
Set the path prefix as a regular expression.
|
Route |
produces(String contentType)
Add a content type produced by this route.
|
Route |
remove()
Remove this route from the router
|
Route |
setRegexGroupsNames(List<String> groups)
When you add a new route with a regular expression, you can add named capture groups for parameters.
|
Route |
subRouter(Router subRouter)
Use a (sub)
Router as a handler. |
Route |
useNormalisedPath(boolean useNormalisedPath)
If true then the normalised request path will be used when routing (e.g.
|
Route method(HttpMethod method)
method
- the HTTP method to addRoute path(String path)
path
- the path prefixRoute pathRegex(String path)
path
- the path regexRoute produces(String contentType)
contentType
- the content typeRoute consumes(String contentType)
contentType
- the content typeRoute order(int order)
order
- the orderRoute last()
Route handler(Handler<RoutingContext> requestHandler)
requestHandler
- the request handlerRoute blockingHandler(Handler<RoutingContext> requestHandler)
blockingHandler(Handler, boolean)
called with ordered = trueRoute subRouter(Router subRouter)
Router
as a handler. There are several requirements to be fulfilled for this
to be accepted.
subRouter
- the router to addRoute blockingHandler(Handler<RoutingContext> requestHandler, boolean ordered)
handler(Handler)
excepted that it will run the blocking handler on a worker thread
so that it won't block the event loop. Note that it's safe to call context.next() from the
blocking handler as it will be executed on the event loop context (and not on the worker thread.
If the blocking handler is ordered it means that any blocking handlers for the same context are never executed
concurrently but always in the order they were called. The default value of ordered is true. If you do not want this
behaviour and don't mind if your blocking handlers are executed in parallel you can set ordered to false.requestHandler
- the blocking request handlerordered
- if true handlers are executed in sequence, otherwise are run in parallelRoute failureHandler(Handler<RoutingContext> failureHandler)
failureHandler
- the request handlerRoute remove()
Route disable()
Route enable()
Route useNormalisedPath(boolean useNormalisedPath)
useNormalisedPath
- use normalised path for routing?String getPath()
boolean isRegexPath()
Set<HttpMethod> methods()
Route setRegexGroupsNames(List<String> groups)
groups
- group namesCopyright © 2023 Eclipse. All rights reserved.