com.fastchar.core.FastActions Maven / Gradle / Ivy
package com.fastchar.core;
import com.fastchar.out.FastOut;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* FastAction插件
*/
public final class FastActions {
private Class extends FastOut> defaultOut;
private List excludeUrls = new ArrayList<>();//排除拦截url
private boolean excludeServlet = true;//排除拦截servlet
FastActions() {
}
public FastActions add(Class extends FastAction> actionClass) throws Exception {
if (Modifier.isAbstract(actionClass.getModifiers())) {
return this;
}
if (Modifier.isInterface(actionClass.getModifiers())) {
return this;
}
if (!Modifier.isPublic(actionClass.getModifiers())) {
return this;
}
FastDispatcher.actionResolver(actionClass);
return this;
}
public Class extends FastOut> getDefaultOut() {
return defaultOut;
}
public FastActions setDefaultOut(Class extends FastOut> defaultOut) {
this.defaultOut = defaultOut;
return this;
}
/**
* 排除路径,例如:/druid/*,/user/servlet.action
* @param urlPatterns
* @return
*/
public FastActions addExcludeUrls(String... urlPatterns) {
this.excludeUrls.addAll(Arrays.asList(urlPatterns));
return this;
}
public List getExcludeUrls() {
return excludeUrls;
}
public boolean isExcludeServlet() {
return excludeServlet;
}
public FastActions setExcludeServlet(boolean excludeServlet) {
this.excludeServlet = excludeServlet;
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy