Interface ErrorWebRouteInterceptorManager<A extends ExchangeContext,B extends ErrorWebRouteInterceptor<A>>
- Type Parameters:
A
- the exchange context typeB
- the error Web route interceptor type
Defines error Web route interceptors and creates decorated Web servers intercepting error Web routes.
An error Web route interceptor manager is obtained from WebServer.interceptError()
, it allows to specify the criteria an error Web route must match to be intercepted by the exchange
interceptors defined in interceptor(ExchangeInterceptor)
or interceptors(List)
. These methods return the intercepted Web server which shall be used to define error Web routes
intercepted when they are matching the defined criteria.
It is possible to specify multiple values for any given criteria resulting in multiple Web route interceptor definitions being created in the resulting Web route interceptor. For instance, the following code will result in two definitions being created:
webServer
.interceptError()
.error(IllegalArgumentException.class)
.error(BadRequestException.class)
.interceptor(errorExchange -> {...})
- Since:
- 1.12
- 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 route to be intercepted.Specifies the type of errors that must be matched by an error Web route to be intercepted.interceptor
(ExchangeInterceptor<? super A, ErrorWebExchange<A>> interceptor) Specifies the error Web exchange interceptor to apply to an error Web route matching the criteria specified in the route manager and returns an error Web route interceptor containing the newly defined interceptor definitions.interceptors
(List<ExchangeInterceptor<? super A, ErrorWebExchange<A>>> interceptors) Specifies a list of error Web exchange interceptors to apply to an error Web route matching the criteria specified in the route manager and returns an error Web route interceptor containing the newly defined interceptor definitions.Specifies the language range as defined by RFC 7231 Section 5.3.5 matching the language produced by the error Web routes to intercept.default ErrorWebRouteInterceptorManager
<A, B> Specifies the absolute path that must be matched by an error Web route to be intercepted.Specifies the absolute path that must be matched with or without trailing slash by an error Web route to be intercepted.Specifies the media range as defined by RFC 7231 Section 5.3.2 matching the content type produced by the error Web routes to intercept.
-
Method Details
-
error
Specifies the type of errors that must be matched by an error Web route to be intercepted.
- Parameters:
error
- an error type- Returns:
- the interceptor manager
-
path
Specifies the absolute path that must be matched by an error Web route to be intercepted.
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 interceptor manager
- Throws:
IllegalArgumentException
- if the specified path is not absolute
-
path
ErrorWebRouteInterceptorManager<A,B> path(String path, boolean matchTrailingSlash) throws IllegalArgumentException Specifies the absolute path that must be matched with or without trailing slash by an error Web route to be intercepted.
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 interceptor 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 route to be intercepted.
- Parameters:
mediaRange
- a media range (e.g.application/*
)- Returns:
- the interceptor manager
-
produce
Specifies the media range as defined by RFC 7231 Section 5.3.2 matching the content type produced by the error Web routes to intercept.
- Parameters:
mediaRange
- a media range (e.g.application/*
)- Returns:
- the interceptor manager
-
language
Specifies the language range as defined by RFC 7231 Section 5.3.5 matching the language produced by the error Web routes to intercept.
- Parameters:
languageRange
- a language range (e.g.*-FR
)- Returns:
- the interceptor manager
-
interceptor
Specifies the error Web exchange interceptor to apply to an error Web route matching the criteria specified in the route manager and returns an error Web route interceptor containing the newly defined interceptor definitions.
The error Web route interceptor manager is usually obtained from
WebServer.interceptError()
in which case the resulting error Web route interceptor is aWebServer.Intercepted
instance.- Parameters:
interceptor
- an error Web exchange interceptor- Returns:
- a new error Web route interceptor containing the configured interceptor
-
interceptors
Specifies a list of error Web exchange interceptors to apply to an error Web route matching the criteria specified in the route manager and returns an error Web route interceptor containing the newly defined interceptor definitions.
The error Web route interceptor manager is usually obtained from
WebServer.interceptError()
in which case the resulting error Web route interceptor is aWebServer.Intercepted
instance.- Parameters:
interceptors
- a list of error Web exchange interceptors- Returns:
- a new error Web route interceptor containing the configured interceptor
-