Search in sources :

Example 1 with InterceptorRef

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;
}
Also used : ArrayList(java.util.ArrayList) InterceptorRef(org.apache.struts2.convention.annotation.InterceptorRef) InterceptorMapping(com.opensymphony.xwork2.config.entities.InterceptorMapping)

Example 2 with InterceptorRef

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;
}
Also used : ArrayList(java.util.ArrayList) InterceptorRef(org.apache.struts2.convention.annotation.InterceptorRef) InterceptorMapping(com.opensymphony.xwork2.config.entities.InterceptorMapping) InterceptorRefs(org.apache.struts2.convention.annotation.InterceptorRefs)

Aggregations

InterceptorMapping (com.opensymphony.xwork2.config.entities.InterceptorMapping)2 ArrayList (java.util.ArrayList)2 InterceptorRef (org.apache.struts2.convention.annotation.InterceptorRef)2 InterceptorRefs (org.apache.struts2.convention.annotation.InterceptorRefs)1