Annotation Type ServerResponseFilter
-
@Retention(RUNTIME) @Target(METHOD) public @interface ServerResponseFilter
When used on a method, then an implementation ofContainerResponseContextis generated that calls the annotated method with the proper arguments The idea behind using this is to make it much to write aServerResponseFilteras all the necessary information is passed as arguments to the method instead of forcing the author to use a mix of@Contextand programmatic CDI look-ups.An example filter could look like this:
public class CustomContainerResponseFilter { private final SomeBean someBean; // SomeBean will be automatically injected by CDI as long as SomeBean is a bean itself public CustomContainerResponseFilter(SomeBean someBean) { this.someBean = someBean; } @ServerResponseFilter public void whatever(SimplifiedResourceInfo resourceInfo) { // do something } }Methods annotated withServerRequestFiltercan declare any of the following parameters (in any order)ContainerRequestContextContainerResponseContextResourceInfoUriInfoSimpleResourceInfoThrowable- The thrown exception - ornullif no exception was thrown
voidorUni<Void>.voidshould be used when filtering does not need to perform any blocking operations.Uni<Void>should be used when filtering needs to perform a blocking operations.
ContainerRequestContextis used as a request parameter, callingabortWithis prohibited by the JAX-RS specification.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description intpriorityThe priority with which this response filter will be executed
-