public sealed interface Routing
Routing abstraction.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA routing entry.static interfaceA group of routing entries prefixed by a common path.static interfaceAdds to the Routing.static enumThe type of route entry. -
Method Summary
Modifier and TypeMethodDescriptionadd(Routing.HttpService service) Add the routes provided by the given HttpService.addAll(Collection<Routing.HttpService> routes) Add all the routes provided by the Routing Services.default RoutingAdd a post-processing filter for all requests.default RoutingAdd a pre-processing filter for all requests.delete(String path, ExchangeHandler handler) Add a DELETE handler.error(Class<T> exceptionClass, ExceptionHandler<T> handler) Registers an error handler that handles the given type of exceptions.Map<Class<?>, ExceptionHandler<?>> Return all the registered Exception Handlers.filter(HttpFilter handler) Add a filter for all requests.filters()Return all the registered filters.get(String path, ExchangeHandler handler) Add a GET handler.handlers()Return all the registered handlers.head(String path, ExchangeHandler handler) Add a HEAD handler.options(String path, ExchangeHandler handler) Add an OPTIONS handler.patch(String path, ExchangeHandler handler) Add a PATCH handler.path(String path, Routing.Group group) Add a group of route handlers with a common path prefix.post(String path, ExchangeHandler handler) Add a POST handler.put(String path, ExchangeHandler handler) Add a PUT handler.trace(String path, ExchangeHandler handler) Add a TRACE handler.Specify permittedRoles for the last added handler using varargs.Specify permittedRoles for the last added handler.
-
Method Details
-
add
Add the routes provided by the given HttpService. -
addAll
Add all the routes provided by the Routing Services. -
withRoles
Specify permittedRoles for the last added handler.routing .get("/customers", getHandler).withRoles(readRoles) .post("/customers", postHandler).withRoles(writeRoles) ...- Parameters:
permittedRoles- The permitted roles required for the last handler
-
withRoles
Specify permittedRoles for the last added handler using varargs.routing .get("/customers", getHandler).withRoles(ADMIN, USER) .post("/customers", postHandler).withRoles(ADMIN) ...- Parameters:
permittedRoles- The permitted roles required for the last handler
-
error
Registers an error handler that handles the given type of exceptions. This will replace an existing error handler for the same exception class.- Type Parameters:
T- exception type- Parameters:
exceptionClass- the type of exception to handle by this handlerhandler- the error handler- Returns:
- updated routing
-
path
Add a group of route handlers with a common path prefix. -
head
Add a HEAD handler. -
get
Add a GET handler. -
post
Add a POST handler. -
put
Add a PUT handler. -
patch
Add a PATCH handler. -
delete
Add a DELETE handler. -
trace
Add a TRACE handler. -
options
Add an OPTIONS handler. -
filter
Add a filter for all requests. -
before
Add a pre-processing filter for all requests. -
after
Add a post-processing filter for all requests. -
handlers
List<Routing.Entry> handlers()Return all the registered handlers. -
filters
List<HttpFilter> filters()Return all the registered filters. -
errorHandlers
Map<Class<?>,ExceptionHandler<?>> errorHandlers()Return all the registered Exception Handlers.
-