2.15.4 Execution order of the interceptors

The execution order of an interceptor is determined according to the following rules by default:

Note that the execution order of the default interceptor described here can be changed using the following method:

Points (1) to (4) describe these rules and the execution order combining the rules for overwriting annotations based on DD. For details on overwriting an annotation based on DD, see 12.6.2 Overwriting annotations based on DD in the uCosminexus Application Server Common Container Functionality Guide.

Organization of this subsection
(1) When the definition for controlling the invocation of the default interceptor and class level interceptor is specified
(2) When the definition for controlling the invocation of the default interceptor is specified
(3) When the definition for controlling the invocation of the class level interceptor is specified
(4) When the definition for controlling the invocation of the upper level interceptor is not specified

(1) When the definition for controlling the invocation of the default interceptor and class level interceptor is specified

The following table describes the execution order of the interceptors when the definition for controlling the invocation of the default interceptor and class level interceptor is specified. In this table, the execution order for combinations shown by Y/N in the column Use of <interceptor-order> for each item number is shown by numbers in front of the DD or annotation in the column Execution order of the interceptor.

Table 2-51 Execution order of the interceptors (when the definition for controlling the invocation of the default interceptor and class level interceptor is specified)

No.Use of <interceptor-order>Execution order of the interceptor
DefaultClass levelMethod levelDefaultClass levelMethod levelInterceptor method
1YYY----1. DD2. Annotation
2YYN----1. Annotation
2. DD
3. Annotation
3YNY----1. DD2. Annotation
4YNN----1. Annotation
2. DD
3. Annotation
5NYY----1. DD2. Annotation
6NYN----1. Annotation
2. DD
3. Annotation
7NNY----1. DD2. Annotation
8NNN----1. Annotation
2. DD
3. Annotation
Legend:
Default: Default interceptor
Class level: Class level interceptor
Method level: Method level interceptor
Interceptor method: Interceptor method specified in the Bean class
Y: Execution order is specified by using the <interceptor-order> tag.
N: Execution order is not specified by using the <interceptor-order> tag.
--: Not executed.
DD: The interceptor specified in the DD is executed.
Annotation: The interceptor specified in the annotation is executed.

(2) When the definition for controlling the invocation of the default interceptor is specified

The following table describes the execution order of the interceptors when the definition for controlling the invocation of the default interceptor is specified. In this table, the execution order for combinations shown by Y/N in the column Use of <interceptor-order> for each item number is shown by numbers in front of the DD or annotation in the column Execution order of the interceptor.

Table 2-52 Execution order of the interceptors (when the definition for controlling the invocation of the default interceptor is specified)

No.Use of <interceptor-order>Execution order of the interceptor
DefaultClass levelMethod levelDefaultClass levelMethod levelInterceptor method
1YYY----1. DD2. Annotation
2YYN--1. DD2. Annotation
3. DD
4. Annotation
3YNY----1. DD2. Annotation
4YNN--1.Annotation
2. DD
3. Annotation
4. DD
5. Annotation
5NYY----1. DD2. Annotation
6NYN--1. DD2. Annotation
3. DD
4. Annotation
7NNY----1.DD2. Annotation
8NNN--1. Annotation
2. DD
3. Annotation
4. DD
5. Annotation
Legend:
Default: Default interceptor
Class level: Class level interceptor
Method level: Method level interceptor
Interceptor method: Interceptor method specified in the Bean class
Y: Execution order is specified by using the <interceptor-order> tag.
N: Execution order is not specified by using the <interceptor-order> tag.
--: Not executed.
DD: The interceptor specified in the DD is executed.
Annotation: The interceptor specified in the annotation is executed.

(3) When the definition for controlling the invocation of the class level interceptor is specified

The following table describes the execution order of the interceptors when the definition for controlling the invocation of the class level interceptor is specified. In this table, the execution order for combinations shown by Y/N in the column Use of <interceptor-order> for each item number is shown by numbers in front of the DD or annotation in the column Execution order of the interceptor.

Table 2-53 Execution order of the interceptors (when the definition for controlling the invocation of the class level interceptor is specified)

No.Use of <interceptor-order>Execution order of the interceptor
DefaultClass levelMethod levelDefaultClass levelMethod levelInterceptor method
1YYY----1. DD2. Annotation
2YYN1. DD--2. Annotation
3. DD
4. Annotation
3YNY----1. DD2. Annotation
4YNN1. DD--2. Annotation
3. DD
4. Annotation
5NYY----1. DD2. Annotation
6NYN1. DD--2. Annotation
3. DD
4. Annotation
7NNY----1. DD2. Annotation
8NNN1. DD--2. Annotation
3. DD
4. Annotation
Legend:
Default: Default interceptor
Class level: Class level interceptor
Method level: Method level interceptor
Interceptor method: Interceptor method specified in the Bean class
Y: Execution order is specified by using the <interceptor-order> tag.
N: Execution order is not specified by using the <interceptor-order> tag.
--: Not executed.
DD: The interceptor specified in the DD is executed.
Annotation: The interceptor specified in the annotation is executed.

(4) When the definition for controlling the invocation of the upper level interceptor is not specified

The following table describes the execution order of the interceptors when the definition for controlling the invocation of the upper level interceptor is not specified. In this table, the execution order for combinations shown by Y/N in the column Use of <interceptor-order> for each item number is shown by numbers in front of the DD or annotation in the column Execution order of the interceptor.

Table 2-54 Execution order of the interceptors (when the definition for controlling the invocation of the upper level interceptor is not specified)

No.Use of <interceptor-order>Execution order of the interceptor
DefaultClass levelMethod levelDefaultClass levelMethod levelInterceptor method
1YYY----1. DD2. Annotation
2YYN--1. DD2. Annotation
3. DD
4. Annotation
3YNY----1. DD2. Annotation
4YNN1. DD2. Annotation
3. DD
4.Annotation
5. DD
6. Annotation
5NYY----1.DD2. Annotation
6NYN--1. DD2. Annotation
3. DD
4. Annotation
7NNY----1.DD2. Annotation
8NNN1. DD2. Annotation
3. DD
4. Annotation
5. DD
6. Annotation
Legend:
Default: Default interceptor
Class level: Class level interceptor
Method level: Method level interceptor
Interceptor method: Interceptor method specified in the Bean class
Y: Execution order is specified by using the <interceptor-order> tag.
N: Execution order is not specified by using the <interceptor-order> tag.
--: Not executed.
DD: The interceptor specified in the DD is executed.
Annotation: The interceptor specified in the annotation is executed.