Skip to content

Latest commit

 

History

History
45 lines (39 loc) · 1.84 KB

enabling_interceptors.adoc

File metadata and controls

45 lines (39 loc) · 1.84 KB

Enabling Interceptors

Only interceptors that are enabled are eligible to be invoked.

Interceptors declared using interceptor bindings are enabled using the Priority annotation (see Section [ordering_interceptors_using_the_priority_annotation]). The Priority annotation also controls interceptor ordering (see Section [interceptor_ordering_rules]).

Interceptors declared using the Interceptors annotation are enabled by that annotation. Using the Interceptors annotation to associate interceptor classes with a target class or a method or constructor of a target class enables them for that target class, method, or constructor. The order in which the interceptor classes are specified in the Interceptors annotation controls interceptor ordering (see Section [interceptor_ordering_rules]). Interceptor methods declared in the target class or in a superclass of the target class are enabled unless overridden.

An extension specification may define alternative mechanisms (e.g., a deployment descriptor such as the CDI beans.xml [bib3] or the EJB ejb-jar.xml deployment descriptor [bib2]) to enable and order interceptors, to override the order specified by means of annotations, or to disable interceptors.

Note: The InvocationContext object allows interceptor methods to control the behavior of the invocation chain, including whether the next method in the chain is invoked and the values of its parameters and result. See Section [invocation_context].