Interface WebRouteInterceptorManager<A extends ExchangeContext,B extends WebRouteInterceptor<A>>
- Type Parameters:
A
- the exchange context typeB
- the Web route interceptor type
Defines Web route interceptors and creates decorated Web servers intercepting Web routes.
A Web route interceptor manager is obtained from WebServer.intercept()
or more generally WebRouteInterceptor.intercept()
, it allows to specify the criteria a 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 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
.intercept()
.path("/path/to/resource")
.method(Method.GET)
.method(Method.POST)
.interceptor(exchange -> {...})
- 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 a Web route to be intercepted.interceptor
(ExchangeInterceptor<? super A, WebExchange<A>> interceptor) Specifies the Web exchange interceptor to apply to a Web route matching the criteria specified in the route manager and returns a Web route interceptor containing the interceptor definitions specified in the interceptor manager.interceptors
(List<ExchangeInterceptor<? super A, WebExchange<A>>> interceptors) Specifies a list of Web exchange interceptors to apply to a Web route matching the criteria specified in the route manager and returns a Web route interceptor containing the interceptor definitions specified in the interceptor manager.Specifies the language range as defined by RFC 7231 Section 5.3.5 matching the language produced by a Web route to be intercepted.Specifies the HTTP method that must be matched by a Web route to be intercepted.default WebRouteInterceptorManager
<A, B> Specifies the absolute path that must be matched by a Web route to be intercepted.Specifies the absolute path that must be matched with or without trailing slash by a Web route to be intercepted.Specifies the media range as defined by RFC 7231 Section 5.3.2 matching the content type produced by a Web route to be intercepted.
-
Method Details
-
path
Specifies the absolute path that must be matched by a Web route to be intercepted.
The 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
Specifies the absolute path that must be matched with or without trailing slash by a Web route to be intercepted.
The 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
-
method
Specifies the HTTP method that must be matched by a Web route to be intercepted.
- Parameters:
method
- an HTTP method- Returns:
- the interceptor manager
-
consume
Specifies the media range as defined by RFC 7231 Section 5.3.2 defining the content types accepted by a 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 a Web route to be intercepted.
- 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 a Web route to be intercepted.
- Parameters:
languageRange
- a language range (e.g.*-FR
)- Returns:
- the interceptor manager
-
interceptor
Specifies the Web exchange interceptor to apply to a Web route matching the criteria specified in the route manager and returns a Web route interceptor containing the interceptor definitions specified in the interceptor manager.
The Web route interceptor manager is usually obtained from
WebServer.intercept()
in which case the resulting Web route interceptor is aWebServer.Intercepted
instance.- Parameters:
interceptor
- a Web exchange interceptor- Returns:
- a new Web route interceptor containing one or more interceptor definitions
-
interceptors
Specifies a list of Web exchange interceptors to apply to a Web route matching the criteria specified in the route manager and returns a Web route interceptor containing the interceptor definitions specified in the interceptor manager.
The Web route interceptor manager is usually obtained from
WebServer.intercept()
in which case the resulting Web route interceptor is aWebServer.Intercepted
instance.- Parameters:
interceptors
- a list of Web exchange interceptors- Returns:
- a new Web route interceptor containing one or more interceptor definitions
-