You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Rémi Aubel (JIRA)" <ji...@apache.org> on 2017/05/11 07:01:04 UTC

[jira] [Created] (CXF-7367) PostMatching filters not invoked for subresources

Rémi Aubel created CXF-7367:
-------------------------------

             Summary: PostMatching filters not invoked for subresources
                 Key: CXF-7367
                 URL: https://issues.apache.org/jira/browse/CXF-7367
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 3.1.11
            Reporter: Rémi Aubel


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}}).

{code:title=ApplicationController.java|borderStyle=solid}
@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());
	}
}
{code}

{code:title=NavigationDrawerController.java|borderStyle=solid}
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class NavigationDrawerController {

	@GET
	public Resource getNavigationDrawerInfo() {
		return getResource();
	}

}
{code}

{code:title=AuthenticationJaxrsFilter.java|borderStyle=solid}
@Provider
@Priority(Priorities.AUTHENTICATION + 1)
public class AuthenticationJaxrsFilter implements ContainerRequestFilter {

	@Override
	public void filter(ContainerRequestContext context) throws IOException {
		System.out.println("AuthenticationServletFilter triggered");
	}

}
{code}

If I add the {{@PreMatching}} annotation to the filter, it is called in both cases.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)