Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
3.1.11
-
None
-
None
-
Unknown
Description
PreMatching filters are always called, whatever the resource behind.
But PostMatching are called only for root resources.
Given the three classes below (resource, subresource and filter), the filter is invoked only for the resource (/app), but it is not for the subresource (/app/nav).
ApplicationController.java
@Path("app") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class ApplicationController { @Context private ResourceContext resourceContext; public ApplicationController() {} @GET public Resource getApplicationInfo() { return getResource(); } @Path("nav") public NavigationDrawerController getNavigationDrawer() { return resourceContext.initResource(new NavigationDrawerController()); } }
NavigationDrawerController.java
@Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class NavigationDrawerController { @GET public Resource getNavigationDrawerInfo() { return getResource(); } }
AuthenticationJaxrsFilter.java
@Provider @Priority(Priorities.AUTHENTICATION + 1) public class AuthenticationJaxrsFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext context) throws IOException { System.out.println("AuthenticationServletFilter triggered"); } }
If I add the @PreMatching annotation to the filter, it is called in both cases.