[jax-rs-spec users] [jsr339-experts] ContainerResponseFilter question

From: Jan Algermissen <>
Date: Mon, 24 Sep 2012 12:38:00 +0200


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:

public class AddCacheControlFilter implements ContainerResponseFilter {
        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:

   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?