Package io.micronaut.http.annotation
Annotation Interface ResponseFilter
@Documented
@Retention(RUNTIME)
@Target(METHOD)
@Inherited
@Executable
public @interface ResponseFilter
Method annotation for a response filter. A response filter is called after a request has been
sent and the response received. Possible parameter types are:
HttpRequest
orMutableHttpRequest
, to access the requestHttpResponse
orMutableHttpResponse
, to access the response- A
Throwable
type, to handle an error. If there is an error in the downstream filters, it is processed by the upstream response filters. Any response filter that does not declare aThrowable
parameter of a matching type is skipped. If instead there is no downstream error, those response filters with aThrowable
parameter are skipped, unless the parameter isNullable
. Note that for server filter execution, exceptions are transformed into non-exceptional responses with an error status code, between each filter. - A
@
Header
,@
QueryValue
or@
CookieValue
parameter - A
MutablePropagatedContext
to modify the propagated context - A RouteMatch of the route that handled this request. Note: Unless the parameter is
marked as
Nullable
, the filter method will not match for requests that do not match a route (e.g. static resources). This parameter is only supported on the server.
void
ornull
to immediately continue execution, without changing the response- An updated
HttpResponse
- A
Publisher
(or other reactive type) that produces any of these return types, to delay further execution
- Since:
- 4.0.0
- Author:
- Jonas Konrad
-
Field Details
-
MATCH_ALL_PATTERN
Pattern used to match all requests.- See Also:
-
-
Element Details
-
value
String[] value- Returns:
- The patterns this filter should match
- Default:
- {}
-
patternStyle
FilterPatternStyle patternStyle- Returns:
- The style of pattern this filter uses
- Default:
- ANT
-
patterns
Same asvalue()
.- Returns:
- The patterns
- Default:
- {}
-
methods
HttpMethod[] methods- Returns:
- The methods to match. Defaults to all
- Default:
- {}
-