[jax-rs-spec users] Re: _at_PreMatching and _at_NameBinding

From: Santiago Pericas-Geertsen <>
Date: Fri, 4 Jan 2013 09:43:46 -0500

On Jan 3, 2013, at 8:02 PM, Arun Gupta <> wrote:

> Hi Santiago,
> On 1/2/13 6:34 AM, Santiago Pericas-Geertsen wrote:
>> Hi Arun,
>> On Dec 28, 2012, at 6:45 PM, Arun Gupta <> wrote:
>>> @PreMatching javadoc says:
>>> -- cut here --
>>> Global binding annotation that can be applied to a container request filter to indicate that such filter should be applied globally on all resources in the application before the actual resource matching occurs.
>>> -- cut here
>>> Does that mean @PreMatching can be put on filters that have @NameBinding ?
>> Name binding is, of course, post-matching by definition. I don't think the spec is currently forbidding the case of a container request filter being executed at pre _and_ post extension points. So, I'd say the answer is "yes".
> @PreMatching filters are global so why would anybody put @NameBinding on them ?

 Not sure I have a good use case for you. But perhaps someone wants to execute a logging filter twice, before and after matching. So, this would effectively be 2 bindings --not unlike having 2 name binding annotations.

>>> Or restricted to a specific resource using DynamicFeature ?
>> I'm not sure how DynamicFeature relates to your first question. Can you elaborate?
> I mean @PreMatching can be restricted to a specific resource, instead of all the resources globally, using DynamicFeature. Is that possible ?

 No, the binding scope of a pre-matching filter cannot be changed. Pre-matching filters are executed before matching, so I can't binding them to a method (as that would require matching the method). Is that your question?

-- Santiago