Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdi-dev] Getting interceptor bindings in standard way

Yeah, this is something I have seen requested a few times and used in Weld.
FTR it's not just Weld doing it via InvocationContext, Quarkus also uses the same approach[1].

We should probably re-recreate the CDI JIRA as GH issue not to loose track of this.
Will you do that, or should I?

I am +1 for putting the bindings under InvocationContext with a key specified by CDI spec.
This is, at this point, a de facto standard, so let's make it de jure one.
It also requires zero changes in other specs and all we need to do is define a String constant as a key.

At the same time I have to say I am -1 for your second alternative.
Such syntax is against interceptors spec (for instance against how around invoke method needs to look like)[2] plus I don't think it's nice given that you can have multiple bindings.

Regards
Matej
_____________________________________________________________________________________________________________
[1] https://github.com/quarkusio/quarkus/blob/master/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcInvocationContext.java#L15
[2] https://github.com/eclipse-ee4j/interceptor-api/blob/master/api/src/main/java/jakarta/interceptor/AroundInvoke.java#L26-L28

----- Original Message -----
> From: "arjan tijms" <arjan.tijms@xxxxxxxxx>
> To: "cdi developer discussions" <cdi-dev@xxxxxxxxxxx>
> Sent: Monday, November 23, 2020 6:24:06 PM
> Subject: [cdi-dev] Getting interceptor bindings in standard way
> 
> Hi,
> 
> A particular issue in CDI is obtaining the interceptor binding annotations
> from within an interceptor.
> 
> Interceptors may use the target bean class for this, but this doesn't work if
> the interceptor binding was added dynamically. Currently Jakarta spec
> implementations like e.g. Soteria use Weld specific code for this (and
> should also contain OWB specific code).
> 
> See:
> https://github.com/eclipse-ee4j/soteria/blob/master/impl/src/main/java/org/glassfish/soteria/cdi/LoginToContinueInterceptor.java#L314
> 
> There's an existing issue for this:
> 
> https://issues.redhat.com/browse/CDI-468
> 
> There's basically two viable solutions for this:
> 
> 1. Standardise the key to obtain these from the context. Currently Weld uses
> "org.jboss.weld.interceptor.bindings". We could define this to be
> "jakarta.interceptor.bindings"
> 
> 2. Inject them into the intercept method, e.g. intercept(InvocationContext
> context, MyBinding myBinding)
> 
> Thoughts?
> 
> Kind regards,
> Arjan Tijms
> 
> 
> _______________________________________________
> cdi-dev mailing list
> cdi-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/cdi-dev
> 



Back to the top