[jax-rs-spec users] [jsr339-experts] Re: Ordering of global and name-bound filters

From: Sergey Beryozkin <>
Date: Thu, 13 Sep 2012 15:49:33 +0100

It's me again :-), sorry, I can't just put all the thoughts in a single
email, I send and then I have something else to say immediately
afterwards :-)
On 13/09/12 15:38, Sergey Beryozkin wrote:
> On 13/09/12 15:35, Sergey Beryozkin wrote:
>> On 13/09/12 14:53, Santiago Pericas-Geertsen wrote:
>>> On Sep 13, 2012, at 7:17 AM, Sergey Beryozkin wrote:
>>>> When selecting the filters to be run, before a given selected
>>>> resource method is invoked, what priority should be given to global
>>>> filters as opposed to name-bound ones ?
>>>> I know BindingPriority is there, but should name-bound filters be run
>>>> first, and global filters afterwards, no matter of what their
>>>> individual priorities are ?
>>> No, they are part of the same "post-matching chain". Therefore, should
>>> be sorted by binding priority regardless of their kind.
>> I still think it should be used at least as a secondary key, which will
>> do well in cases where no BindingPriority is used on filters.
>> If I have 2 global and 3 name-bound filters, I'm not keen and adding 1,
>> 2, 3, 4, 5 priority annotations, but I'd like to make sure global
>> filters are executed say before name-bound filters
> Especially when we have different methods having their own name-bound
> filters, with some of the name-bound filters mixed up between different
> methods. It can be awkward to ensure say all name-bound ones have
> priority number set up right for an expectation that say global filters
> will run before or after name bound ones

PreMatch global filters are having a higher priority over Post-Match and
name-bound filters, despite PreMatch ones may have their own
BindingPriorities. And they are *global*. IMHO, for consistency
purposes, global PostMatch interceptors need to be run before name-bound

Cheers, Sergey

> Sergey