Access api resource method's metadata inside micronaut HttpServerFilter #5578
-
With jaxrs/jersey you can you can inject ResourceInfo into the server request interceptor(ContainerRequestFilter). This allows users to write a server request interceptor which can be specific to a certain resource method or path. With HttpServerFilter it can bind to a path. But inside the filter there's no way to access metadata of the matching resource method. How can I do that? (via jaxrs or via micronaut way) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The route match is an attribute on the request. |
Beta Was this translation helpful? Give feedback.
The route match is an attribute on the request.
request.getAttribute(HttpAttributes.ROUTE_MATCH, AnnotationMetadata.class)
That will provide you with anOptional<AnnotationMetadata>
which contains the annotations on the method if available.