protected ActionWrapper [ ] createExecutionArray ( ) { int totalInterceptors = ( this . actionRuntime . getInterceptors ( ) != null ? this . actionRuntime . getInterceptors ( ) . length : 0 ) ; int totalFilters = ( this . actionRuntime . getFilters ( ) != null ? this . actionRuntime . getFilters ( ) . length : 0 ) ; ActionWrapper [ ] executionArray = new ActionWrapper [ totalFilters + 1 + totalInterceptors + 1 ] ; // filters int index = 0 ; if ( totalFilters > 0 ) { System . arraycopy ( actionRuntime . getFilters ( ) , 0 , executionArray , index , totalFilters ) ; index += totalFilters ; } // result is executed AFTER the action AND interceptors executionArray [ index ++ ] = actionRequest -> { Object actionResult = actionRequest . invoke ( ) ; ActionRequest . this . madvocController . render ( ActionRequest . this , actionResult ) ; return actionResult ; } ; // interceptors if ( totalInterceptors > 0 ) { System . arraycopy ( actionRuntime . getInterceptors ( ) , 0 , executionArray , index , totalInterceptors ) ; index += totalInterceptors ; } // action executionArray [ index ] = actionRequest -> { actionResult = invokeActionMethod ( ) ; return actionResult ; } ; return executionArray ; }
Creates execution array that will invoke all filters actions and results in correct order .