*/
public Resolution intercept(ExecutionContext context) throws Exception {
LifecycleStage stage = context.getLifecycleStage();
ActionBeanContext abc = context.getActionBeanContext();
String event = abc == null ? null : abc.getEventName();
Resolution resolution = null;
// Run @Before methods, as long as there's a bean to run them on
if (context.getActionBean() != null) {
ActionBean bean = context.getActionBean();
FilterMethods filterMethods = getFilterMethods(bean.getClass());
List<Method> beforeMethods = filterMethods.getBeforeMethods(stage);
for (Method method : beforeMethods) {
String[] on = method.getAnnotation(Before.class).on();
if (event == null || CollectionUtil.applies(on, event)) {
resolution = invoke(bean, method, stage, Before.class);
if (resolution != null) {
return resolution;
}
}
}
}
// Continue on and execute other filters and the lifecycle code
resolution = context.proceed();
// Run After filter methods (if any)
if (context.getActionBean() != null) {
ActionBean bean = context.getActionBean();
FilterMethods filterMethods = getFilterMethods(bean.getClass());
List<Method> afterMethods = filterMethods.getAfterMethods(stage);
// Re-get the event name in case we're executing after handler resolution
// in which case the name will have been null before, and non-null now
event = abc == null ? null : abc.getEventName();
Resolution overrideResolution = null;
for (Method method : afterMethods) {
String[] on = method.getAnnotation(After.class).on();
if (event == null || CollectionUtil.applies(on, event)) {
overrideResolution = invoke(bean, method, stage, After.class);
if (overrideResolution != null) {