Package io.micronaut.http.annotation
Annotation Interface RequestFilter
@Documented
@Retention(RUNTIME)
@Target(METHOD)
@Inherited
@Executable
public @interface RequestFilter
Method annotation for a request filter. A request filter is called before the request is sent
out. Possible parameter types are:
HttpRequest
orMutableHttpRequest
, to access the requestFilterContinuation
<HttpResponse
>,FilterContinuation
<Publisher
<HttpResponse
>>. A call to the continuation (and, for the reactive variant, subscribing to thePublisher
) will trigger execution of downstream filters, and finally perform the request. The response returned by the continuation will be the response produced by the downstream, and can be modified and returned. Note that if you call a non-reactive continuation, the call will block, which may block the netty event loop. For that reason, always mark such a filter withExecuteOn
- A
@
Header
,@
QueryValue
or@
CookieValue
parameter - A
@
Body
parameter of typebyte[]
,String
orByteBuffer
. Only supported for some HTTP server implementations.
void
ornull
to immediately continue execution, without changing the request or response- An updated
HttpRequest
- A
HttpResponse
to skip execution of the request - 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:
- {}
-