Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WELD-2756 Add support for InvocationContext.getInterceptorBindings() #2863

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/reference/src/main/asciidoc/interceptors.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ Therefore, we recommend the use of CDI-style interceptor bindings.
=== Enhanced version of `jakarta.interceptor.InvocationContext`

For even more control over interceptors, Weld offers enhanced version of `jakarta.interceptor.InvocationContext` - `org.jboss.weld.interceptor.WeldInvocationContext`.

NOTE: *The functionality described below is deprecated since Weld 6 and will be removed in the future. Users should instead use newly added methods directly from `jakarta.interceptor.InvocationContext`, hence removing the need to use Weld specific APIs for this purpose.*

It comes with two additional methods - `getInterceptorBindings` and `getInterceptorBindingsByType(Class<T> annotationType)`.
You shouldn't need this in most cases, but it comes handy when working with `@Nonbinding` values in interceptor binding annotations.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected AbstractInvocationContext(Object target, Method method, Method proceed
this.parameters = parameters;
this.timer = timer;
this.contextData = contextData;
this.interceptorBindings = interceptorBindings;
this.interceptorBindings = interceptorBindings != null ? interceptorBindings : Collections.emptySet();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
import org.junit.Test;
import org.junit.runner.RunWith;

/**
* Tests now deprecated functionality, can be altered/removed once we no longer provide
* {@link org.jboss.weld.interceptor.WeldInvocationContext#INTERCEPTOR_BINDINGS_KEY}
* <p/>
* See https://issues.redhat.com/browse/WELD-2756
*/
@RunWith(Arquillian.class)
public class InvocationContextInterceptorBindingsTest {

Expand Down
Loading