Search in sources :

Example 6 with InterConfigBean

use of org.eweb4j.mvc.config.bean.InterConfigBean in project eweb4j-framework by laiweiwei.

the class CheckConfigBean method checkMVCInterceptor.

public static String checkMVCInterceptor(InterConfigBean inter, String xmlFile) {
    String error = null;
    ConfigBean cb = (ConfigBean) SingleBeanCache.get(ConfigBean.class.getName());
    if ("true".equalsIgnoreCase(cb.getMvc().getOpen()) || "1".equals(cb.getMvc().getOpen())) {
        StringBuilder sb = new StringBuilder();
        if (!"".equals(inter.getClazz())) {
            try {
                if (Thread.currentThread().getContextClassLoader().loadClass(inter.getClazz()) == null) {
                    sb.append("当前您填写的( class=").append(inter.getClazz()).append(" )是错误的!它必须是一个有效的类 ;\n");
                }
            } catch (ClassNotFoundException e) {
                sb.append("当前您填写的( class=").append(inter.getClazz()).append(" )是错误的!它必须是一个有效的类 ;\n");
            }
        }
        if (inter.getType() == null)
            inter.setType("");
        if (!"".equals(inter.getType()) && !"before".equalsIgnoreCase(inter.getType()) && !"after".equalsIgnoreCase(inter.getType())) {
            sb.append("当前您填写的:( type=").append(inter.getType()).append(" )是错误的!它只能填写为:before|after|留空  中的一种 ;").append("\n");
        }
        if (inter.getPolicy() != null && !"".equals(inter.getPolicy()) && !"and".equalsIgnoreCase(inter.getPolicy()) && !"or".equalsIgnoreCase(inter.getPolicy())) {
            sb.append("当前您填写的:( policy=").append(inter.getPolicy()).append(" )是错误的!它只能填写为:and|or|留空  中的一种 ;").append("\n");
        }
        for (Uri url : inter.getUri()) {
            if (url.getType() == null)
                url.setType("");
            if (!"start".equalsIgnoreCase(url.getType()) && !"end".equalsIgnoreCase(url.getType()) && !"contains".equalsIgnoreCase(url.getType()) && !"all".equalsIgnoreCase(url.getType()) && !"regex".equalsIgnoreCase(url.getType()) && !"!start".equalsIgnoreCase(url.getType()) && !"!end".equalsIgnoreCase(url.getType()) && !"!contains".equalsIgnoreCase(url.getType()) && !"!all".equalsIgnoreCase(url.getType()) && !"!regex".equalsIgnoreCase(url.getType()) && !"*".equals(url.getType()) && !"actions".equals(url.getType()) && !"!actions".equals(url.getType()) && !"".equals(url.getType())) {
                sb.append("当前您填写的:( type=").append(url.getType()).append(" )是错误的!它只能填写为:start|end|contains|all|regex|!start|!end|!contains|!all|!regex|*|留空  中的一种 ;").append("\n");
            }
        }
        if (!"".equals(sb.toString())) {
            error = "\n<br /><b>" + xmlFile + ":[bean name=" + inter.getName() + "]</b>\n" + sb.toString();
        }
    }
    return error;
}
Also used : ORMConfigBean(org.eweb4j.orm.config.bean.ORMConfigBean) FieldConfigBean(org.eweb4j.mvc.config.bean.FieldConfigBean) DBInfoConfigBean(org.eweb4j.orm.dao.config.bean.DBInfoConfigBean) ParamConfigBean(org.eweb4j.mvc.config.bean.ParamConfigBean) ResultConfigBean(org.eweb4j.mvc.config.bean.ResultConfigBean) IOCConfigBean(org.eweb4j.ioc.config.bean.IOCConfigBean) LogConfigBean(org.eweb4j.config.bean.LogConfigBean) ActionConfigBean(org.eweb4j.mvc.config.bean.ActionConfigBean) ConfigBean(org.eweb4j.config.bean.ConfigBean) InterConfigBean(org.eweb4j.mvc.config.bean.InterConfigBean) ValidatorConfigBean(org.eweb4j.mvc.config.bean.ValidatorConfigBean) Uri(org.eweb4j.mvc.config.bean.Uri)

Aggregations

InterConfigBean (org.eweb4j.mvc.config.bean.InterConfigBean)6 ArrayList (java.util.ArrayList)3 Uri (org.eweb4j.mvc.config.bean.Uri)3 ConfigBean (org.eweb4j.config.bean.ConfigBean)2 File (java.io.File)1 CheckConfigBean (org.eweb4j.config.CheckConfigBean)1 LogConfigBean (org.eweb4j.config.bean.LogConfigBean)1 IOCConfigBean (org.eweb4j.ioc.config.bean.IOCConfigBean)1 Singleton (org.eweb4j.mvc.action.annotation.Singleton)1 ActionConfigBean (org.eweb4j.mvc.config.bean.ActionConfigBean)1 FieldConfigBean (org.eweb4j.mvc.config.bean.FieldConfigBean)1 ParamConfigBean (org.eweb4j.mvc.config.bean.ParamConfigBean)1 ResultConfigBean (org.eweb4j.mvc.config.bean.ResultConfigBean)1 ValidatorConfigBean (org.eweb4j.mvc.config.bean.ValidatorConfigBean)1 Interceptor (org.eweb4j.mvc.interceptor.Interceptor)1 Uri (org.eweb4j.mvc.interceptor.Uri)1 ORMConfigBean (org.eweb4j.orm.config.bean.ORMConfigBean)1 DBInfoConfigBean (org.eweb4j.orm.dao.config.bean.DBInfoConfigBean)1 XMLReader (org.eweb4j.util.xml.XMLReader)1