users@jax-rs-spec.java.net

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

From: Arun Gupta <arun.p.gupta_at_oracle.com>
Date: Fri, 04 Jan 2013 10:55:38 -0800

Got it, thanks!

On 1/4/13 6:43 AM, Santiago Pericas-Geertsen wrote:
>
> On Jan 3, 2013, at 8:02 PM, Arun Gupta <arun.p.gupta_at_oracle.com
> <mailto:arun.p.gupta_at_oracle.com>> 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 <arun.p.gupta_at_oracle.com
>>> <mailto:arun.p.gupta_at_oracle.com>> wrote:
>>>
>>>> @PreMatching javadoc says:
>>>>
>>>> -- cut here --
>>>> Global binding annotation that can be applied to a|container
>>>> request filter|
>>>> <http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/container/ContainerRequestFilter.html>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
>
>

-- 
http://twitter.com/arungupta
http://blogs.oracle.com/arungupta