Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7367

PostMatching filters not invoked for subresources

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 3.1.11
    • None
    • JAX-RS
    • 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.

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            raubel RĂ©mi Aubel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: