On Aug 23, 2012, at 7:13 PM, Bill Burke <bburke_at_redhat.com> wrote:
>
>
> On 8/23/2012 12:38 PM, Marek Potociar wrote:
>>
>> On Aug 23, 2012, at 5:03 PM, Bill Burke <bburke_at_redhat.com
>> <mailto:bburke_at_redhat.com>> wrote:
>>
>>>
>>>
>>> On 8/23/2012 8:06 AM, Marek Potociar wrote:
>>>> Btw. seems to me that dynamically bound global filter that has all
>>>> the necessary resource-specific initialization properties (e.g.
>>>> ResourceInfo etc.) pre-computed at deploy time will be anyway more
>>>> efficient than a global post-matching filter that will need to inject
>>>> proxied resource information with every request.
>>>>
>>>
>>> Ya, we precompute post match request filters and response filters and
>>> reader/writer interceptors at deploy/redeploy time.
>>
>> I wonder what do you do for sub-resources? That's something that cannot
>> be generally pre-computed, right?
>>
>
> Can't precompute at deploy time, no, but we cache mappings and other metadata based on class on demand. Otherwise sub-resource invocations would be really inefficient.
Yup. Once again we have a match.
>
>
>> What about the distinction between pre-post matching request filters? Do
>> we need that at all? Can we just have all "unbound" filters pre-matching
>> and all name-bound or dynamically-bound post-matching?
>
> I don't think we can do that (remove @PreMach). For example, something like @RolesAllowed is a name-bound filter and authorization should really come before as many filters as possible, don't you think?
But isn't that something that may be completely resource-method specific? IOW, doesn't it have to be done only after the resource method has been matched?
>
>
> (Note that
>> name-bound can be applied to the Application class which would make them
>> global & post-matching by default.)
>
> Can you explain more what you're talking about with Application class?
@Logged
public class MyApplication extends javax.ws.rs.core.Application {
...
}
Applying a name-binding annotation to the JAX-RS application sub-class as in the example above enables a name-bound filter "globally" on all resource methods. At least that was the original intention, but I cannot find anything in the spec. Looks like we have a hole to fill.
Marek
>
>
> Bill
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com