Using Jersey 2.25 with @NamedBinding sub-resource methods aren't getting filters called.
In the following, the getData() method triggers the AuthorizationFilter, but the getSubDetails() method does not.
@NameBinding
@Retention(RUNTIME)
@Target({ TYPE, METHOD })
public @interface Secured {
Permission[] value() default {};
}
@Secured
@Provider
@Priority(Priorities.AUTHORIZATION)
public class AuthorizationFilter implements ContainerRequestFilter {
...
}
@Produces(MediaType.APPLICATION_JSON)
@Path("api/v1/jobs/{jobId}/document-sources")
@Secured(Permission.JOB_READER)
public class MyEndpoint {
@Path("/{subId}")
@GET
@Secured(Permission.READ)
public Class<?> getData(@PathParam("subId") String subId){
return "data";
}
@Path("/{subId}/details")
@Secured(Permission.READ)
public Class<?> getSubDetails(@PathParam("subId") String subId){
return SubDetails.class;
}
}
The JAX-RS documentation ( https://docs.oracle.com/javaee/7/api/javax/ws/rs/container/ContainerRequestFilter.html ) seems to imply that the filter should be working on sub-resources.
Am I doing something wrong? Do NameBinding filters not apply to sub-resource methods anymore?