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

[jsr339-experts] Re: more interceptor discussions

From: Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com>
Date: Tue, 24 May 2011 17:16:39 -0400

Bill,

 Thanks for getting the discussion going and responding to the proposal. I think there's roughly 4 areas up for discussion: (i) interception points (ii) interceptor interfaces (iii) binding (iv) ordering.

 Here is my take on these areas so far:

 (i) Interception points: I incorrectly attempted to determine these points while leaving the async case aside in my proposal, but clearly this is the wrong approach. After further analysis, I think the interception points in your proposal are spot on based on the use cases (except maybe for one, but I'll get back to it at some other point as I don't think it's that common).

 (ii) Interfaces: Clearly these will be derived from (i). Your proposal currently has 8 interfaces (excluding a base class): 2 handlers, 2 interceptors and 4 contexts. Using these interfaces will help you catch unwanted errors statically, but in the interest of simplicity we could cut this number in half and catch a few errors dynamically. I would opt for a solution with half the number of classes.

 (iii) Binding: I believe we should include a (server side) static binding mechanism using annotations (and meta-annotations) a la CDI, as described in my proposal. This seems to fit well in context of a JAX-RS application. Additionally supporting the AcceptedByMethod approach (dynamic binding) would be OK by me as well.

 (iv) Ordering: As you pointed out in your blog, the numeric ordering approach in my proposal is a lot simpler. Yet, I believe there's something even better that we haven't explored. I think part of the complication is allowing users to define _custom precedence families_. Do you know of any Resteasy developers that use this feature?

-- Santiago

On May 24, 2011, at 11:42 AM, Bill Burke wrote:

> Santiago wrote a good blog on interception:
>
> http://java.net/projects/jax-rs-spec/pages/InterceptorsAndFilters
>
> I responded:
>
> http://bill.burkecentral.com/2011/05/24/interceptors-in-jax-rs-2-0/
>
> IMO, we might want to keep discussions here rather than go back and forth between blogs.
>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com