ResourceFilterFactory and non-Path annotated Resources

Posted by tousdan on Stack Overflow See other posts from Stack Overflow or by tousdan
Published on 2013-06-26T16:20:03Z Indexed on 2013/06/26 16:21 UTC
Read the original article Hit count: 247

Filed under:
|
|

(I'm using Jersey 1.7)

I am attempting to add a ResourceFilterFactory in my project to select which filters are used per method using annotations.

The ResourceFilterFactory seems to be able to filters on Resources which are annotated with the Path annotation but it would seem that it does not attempt to generate filters for the methods of the SubResourceLocator of the resources that are called.

@Path("a")    
public class A {

 //sub resource locator?
 @Path("b")
 public B getB() { 
   return new B();
 }

 @GET
 public void doGet() {}
}

public class B {
 @GET
 public void doOtherGet() { }

 @Path("c")
 public void doInner() { }
}

When ran, the Filter factory will only be called for the following: AbstractResourceMethod(A#doGet) AbstractSubResourceLocator(A#getB)

When I expected it to be called for every method of the sub resource.

I'm currently using the following options in my web.xml;

<init-param>
    <param-name>com.sun.jersey.spi.container.ResourceFilters</param-name>
    <param-value>com.my.MyResourceFilterFactory</param-value>
</init-param>

<init-param>
     <param-name>com.sun.jersey.config.property.packages</param-name>
     <param-value>com.my.resources</param-value>
</init-param>

Is my understanding of the filter factory flawed?

© Stack Overflow or respective owner

Related posts about jersey

Related posts about jax-rs