public class RouteImpl extends Object implements Route
Some parts (e.g. content negotiation) from Yoke by Paulo Lopes
| Modifier and Type | Method and Description |
|---|---|
Route |
blockingHandler(Handler<RoutingContext> contextHandler)
Like
Route.blockingHandler(Handler, boolean) called with ordered = true |
Route |
blockingHandler(Handler<RoutingContext> contextHandler,
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> exceptionHandler)
Append a failure handler to the route failure handlers list.
|
String |
getName() |
String |
getPath() |
Route |
handler(Handler<RoutingContext> contextHandler)
Append a request handler to the route handlers list.
|
boolean |
isExactPath()
Returns true of the path doesn't end with a wildcard
* or is null. |
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 regex)
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
|
RouteImpl |
setEmptyBodyPermittedWithConsumes(boolean emptyBodyPermittedWithConsumes) |
Route |
setName(String name)
Giving a name to a route will provide this name as metadata to requests matching this route.
|
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. |
String |
toString() |
Route |
useNormalizedPath(boolean useNormalizedPath)
If true then the normalized request path will be used when routing (e.g.
|
Route |
virtualHost(String hostnamePattern)
Add a virtual host filter for this route.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitrespond, useNormalisedPathpublic Route method(HttpMethod method)
Routepublic Route path(String path)
Routepublic Route pathRegex(String regex)
Routepublic Route produces(String contentType)
Routepublic Route consumes(String contentType)
Routepublic Route virtualHost(String hostnamePattern)
RoutevirtualHost in interface RoutehostnamePattern - the hostname pattern that should match Host header of the requestspublic Route order(int order)
Routepublic Route last()
Routepublic Route handler(Handler<RoutingContext> contextHandler)
Routepublic Route blockingHandler(Handler<RoutingContext> contextHandler)
RouteRoute.blockingHandler(Handler, boolean) called with ordered = trueblockingHandler in interface Routepublic Route subRouter(Router subRouter)
RouteRouter as a handler. There are several requirements to be fulfilled for this
to be accepted.
public Route blockingHandler(Handler<RoutingContext> contextHandler, boolean ordered)
RouteRoute.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.
blockingHandler in interface RoutecontextHandler - the blocking request handlerordered - if true handlers are executed in sequence, otherwise are run in parallelpublic Route failureHandler(Handler<RoutingContext> exceptionHandler)
RoutefailureHandler in interface RouteexceptionHandler - the request handlerpublic Route remove()
Routepublic Route disable()
Routepublic Route useNormalizedPath(boolean useNormalizedPath)
RouteuseNormalizedPath in interface RouteuseNormalizedPath - use normalized path for routing?public String getPath()
public boolean isRegexPath()
RouteisRegexPath in interface Routepublic boolean isExactPath()
Route* or is null.
Regular expression paths are always assumed to be exact.isExactPath in interface Routepublic Set<HttpMethod> methods()
public Route setRegexGroupsNames(List<String> groups)
RoutesetRegexGroupsNames in interface Routegroups - group namespublic Route setName(String name)
Routepublic String getName()
public RouteImpl setEmptyBodyPermittedWithConsumes(boolean emptyBodyPermittedWithConsumes)
Copyright © 2021. All rights reserved.