use of org.apache.struts2.convention.annotation.InterceptorRef in project struts by apache.
the class DefaultInterceptorMapBuilder method build.
protected List<InterceptorMapping> build(InterceptorRef[] interceptors, String actionName, PackageConfig.Builder builder) {
List<InterceptorMapping> interceptorList = new ArrayList<>(10);
for (InterceptorRef interceptor : interceptors) {
LOG.trace("Adding interceptor [{}] to [{}]", interceptor.value(), actionName);
Map<String, String> params = StringTools.createParameterMap(interceptor.params());
interceptorList.addAll(buildInterceptorList(builder, interceptor, params));
}
return interceptorList;
}
use of org.apache.struts2.convention.annotation.InterceptorRef in project struts by apache.
the class DefaultInterceptorMapBuilder method build.
public List<InterceptorMapping> build(Class<?> actionClass, PackageConfig.Builder builder, String actionName, Action annotation) {
List<InterceptorMapping> interceptorList = new ArrayList<>(10);
// from @InterceptorRefs annotation
InterceptorRefs interceptorRefs = AnnotationUtils.findAnnotation(actionClass, InterceptorRefs.class);
if (interceptorRefs != null)
interceptorList.addAll(build(interceptorRefs.value(), actionName, builder));
// from @InterceptorRef annotation
InterceptorRef interceptorRef = AnnotationUtils.findAnnotation(actionClass, InterceptorRef.class);
if (interceptorRef != null)
interceptorList.addAll(build(new InterceptorRef[] { interceptorRef }, actionName, builder));
// from @Action annotation
if (annotation != null) {
InterceptorRef[] interceptors = annotation.interceptorRefs();
if (interceptors != null) {
interceptorList.addAll(build(interceptors, actionName, builder));
}
}
return interceptorList;
}
Aggregations