Package io.micronaut.http.filter
Interface HttpFilter
- All Superinterfaces:
Ordered
- All Known Subinterfaces:
HttpClientFilter
,HttpServerFilter
A interface for classes that can intercept and filter HttpRequest
instances and can
either proceed with the request or return a modified result.
Implementations are passed a FilterChain
where the last entry in the chain in the action to be executed
that returns a Publisher
that emits an HttpResponse
Each filter implements Ordered
and can return an order to increase or decrease the priority of the filter
To modify the request filters can either wrap it (using HttpRequestWrapper
or pass it
along the chain as is
The response can be altered by returning an alternative Publisher
that emits a HttpResponse
or
by altering the publisher returned by FilterChain.proceed(HttpRequest)
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Method Summary
Modifier and TypeMethodDescriptionPublisher<? extends HttpResponse<?>>
doFilter
(HttpRequest<?> request, FilterChain chain) Intercepts aHttpRequest
.
-
Method Details
-
doFilter
Intercepts aHttpRequest
.- Parameters:
request
- TheHttpRequest
instancechain
- TheFilterChain
instance- Returns:
- A
Publisher
for the Http response
-