[JBoss JIRA] (CDI-468) Extend javax.interceptor.InvocationContext
by Matěj Novotný (Jira)
[ https://issues.jboss.org/browse/CDI-468?page=com.atlassian.jira.plugin.sy... ]
Matěj Novotný commented on CDI-468:
-----------------------------------
Those bindings shouldn't be empty, sounds like Weld bug indeed, I am curious to see the reproducer.
Meanwhile, note that Weld also stores those bindings into {{InvocationContext}}, you can use:
{code}
// for the record, this key is stored under WeldInvocationContext in the API
String INTERCEPTOR_BINDINGS_KEY = "org.jboss.weld.interceptor.bindings";
@AroundInvoke
public Object someInterceptor(InvocationContext invocationContext) throws Exception {
final Set<Annotation> interceptorBindings = (Set<Annotation>)invocationContext.getContextData().get(INTERCEPTOR_BINDINGS_KEY);
}
{code}
I wonder if this way you'll see the bindings?
> Extend javax.interceptor.InvocationContext
> ------------------------------------------
>
> Key: CDI-468
> URL: https://issues.jboss.org/browse/CDI-468
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Arne Limburg
> Priority: Major
> Fix For: 2.1 (Discussion)
>
>
> Currently there is no easy way to obtain the interceptor binding annotation for an interceptor call. The interceptor binding annotation is needed to access @Nonbinding attributes and behave accordingly.
> I propose to extend the javax.interceptor.InvocationContext interface with a method
> public Annotation getInterceptorBinding() or
> public <A extends Annotation> A getInterceptorBinding(Class<A> type)
> The @AroundInvoke method of CDI Interceptors may use this extended interface as parameter instead of the original one to obtain the interceptor binding annotation.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (CDI-468) Extend javax.interceptor.InvocationContext
by David Prevost (Jira)
[ https://issues.jboss.org/browse/CDI-468?page=com.atlassian.jira.plugin.sy... ]
David Prevost commented on CDI-468:
-----------------------------------
Thanks for the quick answer, we seem to be using javax.interceptor.Interceptor. I'll look to have a minimal reproduce app and open a new issue.
> Extend javax.interceptor.InvocationContext
> ------------------------------------------
>
> Key: CDI-468
> URL: https://issues.jboss.org/browse/CDI-468
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Arne Limburg
> Priority: Major
> Fix For: 2.1 (Discussion)
>
>
> Currently there is no easy way to obtain the interceptor binding annotation for an interceptor call. The interceptor binding annotation is needed to access @Nonbinding attributes and behave accordingly.
> I propose to extend the javax.interceptor.InvocationContext interface with a method
> public Annotation getInterceptorBinding() or
> public <A extends Annotation> A getInterceptorBinding(Class<A> type)
> The @AroundInvoke method of CDI Interceptors may use this extended interface as parameter instead of the original one to obtain the interceptor binding annotation.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (CDI-468) Extend javax.interceptor.InvocationContext
by Martin Kouba (Jira)
[ https://issues.jboss.org/browse/CDI-468?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba commented on CDI-468:
----------------------------------
[~plum117] Pls create a [Weld issue |https://issues.jboss.org/projects/WELD/issues], ideally with a minimal reproduce app - the set of interceptor bindings should never be empty unless {{(a)javax.interceptor.Interceptors}} was used to associate interceptors.
> Extend javax.interceptor.InvocationContext
> ------------------------------------------
>
> Key: CDI-468
> URL: https://issues.jboss.org/browse/CDI-468
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Arne Limburg
> Priority: Major
> Fix For: 2.1 (Discussion)
>
>
> Currently there is no easy way to obtain the interceptor binding annotation for an interceptor call. The interceptor binding annotation is needed to access @Nonbinding attributes and behave accordingly.
> I propose to extend the javax.interceptor.InvocationContext interface with a method
> public Annotation getInterceptorBinding() or
> public <A extends Annotation> A getInterceptorBinding(Class<A> type)
> The @AroundInvoke method of CDI Interceptors may use this extended interface as parameter instead of the original one to obtain the interceptor binding annotation.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (CDI-468) Extend javax.interceptor.InvocationContext
by Arjan Tijms (Jira)
[ https://issues.jboss.org/browse/CDI-468?page=com.atlassian.jira.plugin.sy... ]
Arjan Tijms commented on CDI-468:
---------------------------------
I think nothing has moved here, as after several years the CDI 2.1 or CDI.Next specification work still hasn't started.
> Extend javax.interceptor.InvocationContext
> ------------------------------------------
>
> Key: CDI-468
> URL: https://issues.jboss.org/browse/CDI-468
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Arne Limburg
> Priority: Major
> Fix For: 2.1 (Discussion)
>
>
> Currently there is no easy way to obtain the interceptor binding annotation for an interceptor call. The interceptor binding annotation is needed to access @Nonbinding attributes and behave accordingly.
> I propose to extend the javax.interceptor.InvocationContext interface with a method
> public Annotation getInterceptorBinding() or
> public <A extends Annotation> A getInterceptorBinding(Class<A> type)
> The @AroundInvoke method of CDI Interceptors may use this extended interface as parameter instead of the original one to obtain the interceptor binding annotation.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (CDI-468) Extend javax.interceptor.InvocationContext
by David Prevost (Jira)
[ https://issues.jboss.org/browse/CDI-468?page=com.atlassian.jira.plugin.sy... ]
David Prevost edited comment on CDI-468 at 10/20/19 2:49 PM:
-------------------------------------------------------------
Any updates on this, I seem to currently encounter this problem using wildfly 17 and weld 3.1.final.
I dynamicaly inject an annotation in a javax.enterprise.inject.spi.Extension like below:
{code:java}
processAnnotatedType.configureAnnotatedType()
.filterMethods(RestHttpAnnotationUtils::isGetOrPostOrPutOrDelete)
.forEach(method -> method.add(new ModelClassOperationSecurityValidationImpl(
ClassOperationPermissionMapping.map(method.getAnnotated()))));
{code}
And the binding is empty in the interceptor surrounded by @AroundInvoke:
{code:java}
@AroundInvoke
public Object modelClassOperationSecurity(InvocationContext invocationContext) throws Exception {
// interceptorBindings is empty
final Set<Annotation> interceptorBindings = ((WeldInvocationContext) invocationContext)
.getInterceptorBindings();
}
{code}
was (Author: plum117):
Any updates on this, I seem to currently encounter this problem using wildfly 17 and weld 3.1.final
> Extend javax.interceptor.InvocationContext
> ------------------------------------------
>
> Key: CDI-468
> URL: https://issues.jboss.org/browse/CDI-468
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Arne Limburg
> Priority: Major
> Fix For: 2.1 (Discussion)
>
>
> Currently there is no easy way to obtain the interceptor binding annotation for an interceptor call. The interceptor binding annotation is needed to access @Nonbinding attributes and behave accordingly.
> I propose to extend the javax.interceptor.InvocationContext interface with a method
> public Annotation getInterceptorBinding() or
> public <A extends Annotation> A getInterceptorBinding(Class<A> type)
> The @AroundInvoke method of CDI Interceptors may use this extended interface as parameter instead of the original one to obtain the interceptor binding annotation.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months
[JBoss JIRA] (CDI-468) Extend javax.interceptor.InvocationContext
by David Prevost (Jira)
[ https://issues.jboss.org/browse/CDI-468?page=com.atlassian.jira.plugin.sy... ]
David Prevost commented on CDI-468:
-----------------------------------
Any updates on this, I seem to currently encounter this problem using wildfly 17 and weld 3.1.final
> Extend javax.interceptor.InvocationContext
> ------------------------------------------
>
> Key: CDI-468
> URL: https://issues.jboss.org/browse/CDI-468
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Reporter: Arne Limburg
> Priority: Major
> Fix For: 2.1 (Discussion)
>
>
> Currently there is no easy way to obtain the interceptor binding annotation for an interceptor call. The interceptor binding annotation is needed to access @Nonbinding attributes and behave accordingly.
> I propose to extend the javax.interceptor.InvocationContext interface with a method
> public Annotation getInterceptorBinding() or
> public <A extends Annotation> A getInterceptorBinding(Class<A> type)
> The @AroundInvoke method of CDI Interceptors may use this extended interface as parameter instead of the original one to obtain the interceptor binding annotation.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
5 years, 2 months