Hi,
playing with ContainerResponseContext I wonder whether there is a way to determin in a ContainerResponseFilter which resource method has handled the request and led to the invocation of the given filter.
What I'd like to do is to access the annotations of that resource method.
For example, in order to do sth like this:
@Provider
@Cacheable
public class AddCacheControlFilter implements ContainerResponseFilter {
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
throws IOException {
String cc = .... determine cache control info from use of @Cacheable on resource method
if(cc != null && !cc.equals("") {
responseContext.getHeaders().add("Cache-Control", cc);
}
}
}
and on the resource method:
@GET
@Cacheable(cacheControl="maxAge=60")
@Produces(MediaType.TEXT_PLAIN)
public String getIt() {
return "This won't change the next 60 seconds...";
}
So far, I cannot see a way to access information about what method handled the request... or am I mistaken?
Jan