jsr370-experts@jax-rs-spec.java.net

Global post match ContainerRequestFilter and subresources

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Wed, 25 Mar 2015 12:35:14 +0000

Hi All

I've had a user query and I'm reviewing the documentation at [1] and I'm
actually not sure if I understand it completely.

Right now, CXF will run the same global post-match
ContainerRequestFilter twice with the following service class:

@Path("rs")
public RSService {
    @Path("sub")
    public RSService sub() {
       return this;
    }
    @Path("resource")
    @GET
    public Response get() {
       //
    }

}

and

GET /rs/sub/resource

once for the sub() method, and once for the get() method.

I vaguely suspect it might be wrong, but the docs at [1] mention that
both resource and subresource methods can be invoked when Name Bindings
are used and in case of a global filter it is effective a wildcard name
binding.

Marek, Santiago, can you please be nice (as you always are :-)) and
clarify: how many times a global filter is expected to be called in the
above case, 1 or 2 ?

Thanks, Sergey

[1]
https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/container/ContainerRequestFilter.html