[cdi-dev] Interceptor bindings from interceptor when using 2.0 interception factory

arjan tijms arjan.tijms at gmail.com
Tue Sep 19 09:22:26 EDT 2017


Hi,

On Tue, Sep 19, 2017 at 1:59 PM, Martin Kouba <mkouba at redhat.com> wrote:

>
>>
> No really. Weld stores the bindings also in context data but the API is
> using a direct reference to a stored set.


Ah, ok, thx



> Going via getContextData() is much easier though for code that has to
>> support both Weld and OWB.
>>
>
> Yep, standardizing the key is the only viable solution without
> interceptors spec change. However, it's not typesafe, easy-to-use, etc.


I hear you. The question is when the earliest opportunity will be to update
the interceptor spec then. With the whole Java EE transfer I guess this
will have to wait at least until that transfer is complete. Hopefully in
the new process we can have something like a hierarchical responsibility
for specs, such that if e.g. Interceptors and AtInject is not explicitly
open, but CDI is, that the CDI EG can take responsibility for it and make
changes there.

For now though, if OWB could also store the bindings under some key,
interceptors that are intended to be portable can practically check both
keys then. Not ideal, but may be a good intermediate solution.



> And this is obviously wrong. Recently, we've reviewed a Narayana PR which
> is about to fix this problem:
> https://github.com/jbosstm/narayana/pull/1211
>
> I personally think that JTA TCK is missing some essential tests here.


Agreed, and the Java EE Security TCK misses those same tests as well, as it
also ships with interceptors.


I don't think this is an InterceptionFactory-specific problem. It's a
> general issue. It should work the same if you use an extension to add an
> interceptor binding.
>


You're right, the InterceptionFactory just brought it to the surface again
for people testing CDI 2.0 features.

Handling stereotypes as per the issue can be a problem as well. I wonder,
wouldn't it be convenient if CDI offers a utility method to look for an
annotation where it would automatically recurses into stereotypes?

I created something like for OmniFaces a while ago:

https://github.com/omnifaces/omnifaces/blob/develop/src/main/java/org/omnifaces/util/BeansLocal.java#L221

Kind regards,
Arjan Tijms



>
>
>> Kind regards,
>> Arjan Tijms
>>
>>
>>
>>
>>
>>         Is there a standard way to get the bindings? Perhaps getting
>>         hold of the Bean<T> that represents the current Interceptor?
>>
>>
>>     You can inject a bean with scope @Dependent, qualifier @Default and
>>     type Interceptor into any interceptor instance. However, this will
>>     not help for @Nonbinding value members of an interceptor binding.
>>
>>
>>         Kind regards,
>>         Arjan Tijms
>>
>>
>>         _______________________________________________
>>         cdi-dev mailing list
>>         cdi-dev at lists.jboss.org <mailto:cdi-dev at lists.jboss.org>
>>         https://lists.jboss.org/mailman/listinfo/cdi-dev
>>         <https://lists.jboss.org/mailman/listinfo/cdi-dev>
>>
>>         Note that for all code provided on this list, the provider
>>         licenses the code under the Apache License, Version 2
>>         (http://www.apache.org/licenses/LICENSE-2.0.html
>>         <http://www.apache.org/licenses/LICENSE-2.0.html>). For all
>>         other ideas provided on this list, the provider waives all
>>         patent and other intellectual property rights inherent in such
>>         information.
>>
>>
>>     --     Martin Kouba
>>     Senior Software Engineer
>>     Red Hat, Czech Republic
>>
>>
>>
> --
> Martin Kouba
> Senior Software Engineer
> Red Hat, Czech Republic
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20170919/4735003b/attachment.html 


More information about the cdi-dev mailing list