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 clients intercepting Web exchanges.
A Web route interceptor manager is obtained from WebClient.intercept()
or more generally WebRouteInterceptor.intercept()
, it allows to specify the criteria a Web exchange must match
to be intercepted by the exchange interceptors defined in interceptor(ExchangeInterceptor)
or interceptors(List)
. These methods return the intercepted Web client which shall be
used to process Web exchanges 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:
webClient
.intercept()
.uri(uri -> uri
.scheme("http")
.host("example.org")
.path("/**")
)
.method(Method.GET)
.method(Method.POST)
.interceptor(exchange -> {...})
- Since:
- 1.12
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A URI configurator used to configure URI criteria in a Web route interceptor manager. -
Method Summary
Modifier and TypeMethodDescriptionSpecifies the media range as defined by RFC 7231 Section 5.3.2 matching the content types consumed (i.e. accepted) by a Web exchange to be intercepted.interceptor
(ExchangeInterceptor<? super A, InterceptedWebExchange<A>> interceptor) Specifies the Web exchange interceptor to apply to a Web exchange 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<? extends ExchangeInterceptor<? super A, InterceptedWebExchange<A>>> interceptors) Specifies a list of Web exchange interceptors to apply to a Web exchange 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 consumed (i.e. accepted) by a Web exchange to be intercepted.Specifies the HTTP method that must be matched by a Web route to be intercepted.Specifies the media range as defined by RFC 7231 Section 5.3.2 defining the content types produced by a Web exchange to be intercepted.uri
(Consumer<WebRouteInterceptorManager.UriConfigurator> uriConfigurer) Specifies the URI that must be matched by a Web exchange to be intercepted.
-
Method Details
-
uri
WebRouteInterceptorManager<A,B> uri(Consumer<WebRouteInterceptorManager.UriConfigurator> uriConfigurer) Specifies the URI that must be matched by a Web exchange to be intercepted.
- Parameters:
uriConfigurer
- a URI configurer- Returns:
- the interceptor manager
-
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 matching the content types consumed (i.e. accepted) by a Web exchange 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 defining the content types produced by a Web exchange 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 consumed (i.e. accepted) by a Web exchange 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 exchange 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
WebClient.intercept()
in which case the resulting Web route interceptor is aWebClient.Intercepted
instance.- Parameters:
interceptor
- a Web exchange interceptor- Returns:
- a new Web route interceptor containing one or more interceptor definitions
-
interceptors
B interceptors(List<? extends ExchangeInterceptor<? super A, InterceptedWebExchange<A>>> interceptors) Specifies a list of Web exchange interceptors to apply to a Web exchange 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
WebClient.intercept()
in which case the resulting Web route interceptor is aWebClient.Intercepted
instance.- Parameters:
interceptors
- a list of Web exchange interceptors- Returns:
- a new Web route interceptor containing one or more interceptor definitions
-