Interface ErrorWebRouteManager<A extends ExchangeContext,B extends ErrorWebRouter<A>>
- Type Parameters:
A
- the exchange context typeB
- the error Web router type
- All Superinterfaces:
BaseWebRouteManager<A,
ErrorWebExchange<A>, ErrorWebRoute<A>, B>
Manages error Web routes in the Web server.
An error Web route manager is obtained from WebServer.routeError()
, it allows to specify the criteria an error Web exchange must match to be handled by the error Web exchange handler
defined in handler(ExchangeHandler)
.
When setting the error exchange handler, interceptors defined in an intercepted Web server are applied to the route when criteria are matching.
It is possible to specify multiple values for any given criteria resulting in multiple error Web routes being created in the error Web router. For instance, the following code will result in the creation of two routes:
webServer
.routeError()
.path("/path/to/resource")
.error(IllegalArgumentException.class)
.error(BadRequestException.class)
.handler(exchange -> {...})
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionSpecifies the media range as defined by RFC 7231 Section 5.3.2 defining the content types accepted by an error Web exchange to be processed by the route.Specifies the type of errors that must be matched by an error Web exchange to be processed by the route.handler
(ExchangeHandler<? super A, ErrorWebExchange<A>> handler) Specifies the error Web exchange handler used to process error Web exchanges matching the criteria specified in the route manager and returns the originating error Web router.Specifies the language tag as defined by RFC 7231 Section 5.3.5 that must be accepted by an error Web exchange to be processed by the route.default ErrorWebRouteManager
<A, B> Specifies the absolute path that must be matched by an error Web exchange to be processed by the route.Specifies the absolute path that must be matched with or without trailing slash by an error Web exchange to be processed by the route.Specifies the media type as defined by RFC 7231 Section 5.3.2 that must be accepted by an error Web exchange to be processed by the route.Methods inherited from interface io.inverno.mod.web.server.BaseWebRouteManager
disable, enable, findRoutes, remove
-
Method Details
-
error
Specifies the type of errors that must be matched by an error Web exchange to be processed by the route.
- Parameters:
error
- an error type- Returns:
- the route manager
-
path
Specifies the absolute path that must be matched by an error Web exchange to be processed by the route.
The specified path can be specified as a parameterized path and include path pattern like
?
,*
,**
as defined byURIBuilder
. Note that this path is only meant to filter routes and as a result path parameters have no use.- Parameters:
path
- a path- Returns:
- the route manager
- Throws:
IllegalArgumentException
- if the specified path is not absolute
-
path
Specifies the absolute path that must be matched with or without trailing slash by an error Web exchange to be processed by the route.
The specified path can be specified as a parameterized path and include path pattern like
?
,*
,**
as defined byURIBuilder
. Note that this path is only meant to filter routes and as a result path parameters have no use.- Parameters:
path
- a pathmatchTrailingSlash
- true to match path with or without trailing slash, false otherwise- Returns:
- the route manager
- Throws:
IllegalArgumentException
- if the specified path is not absolute
-
consume
Specifies the media range as defined by RFC 7231 Section 5.3.2 defining the content types accepted by an error Web exchange to be processed by the route.
- Parameters:
mediaRange
- a media range (e.g.application/*
)- Returns:
- the route manager
-
produce
Specifies the media type as defined by RFC 7231 Section 5.3.2 that must be accepted by an error Web exchange to be processed by the route.
- Parameters:
mediaType
- a media type- Returns:
- the route manager
-
language
Specifies the language tag as defined by RFC 7231 Section 5.3.5 that must be accepted by an error Web exchange to be processed by the route.
- Parameters:
languageTag
- a language tag (e.g.fr-FR
)- Returns:
- the route manager
-
handler
Specifies the error Web exchange handler used to process error Web exchanges matching the criteria specified in the route manager and returns the originating error Web router.
The error Web route manager is usually obtained from
WebServer.routeError()
in which case the resulting error Web router is then aWebServer
instance.Any error Web route interceptor defined in an intercepted Web server and matching the criteria specified in the route manager is applied to the resulting Web routes.
- Parameters:
handler
- an error Web exchange handler- Returns:
- the originating error Web router
-