NutzCN Logo
问答 重新的match() 打断点没有执行,但是过滤器可以拦截未登陆的页面,并跳转到登录页面,怎么回事?
发布于 2813天前 作者 qq_7514e59c 1629 次浏览 复制 上一个帖子 下一个帖子
标签:

公司原有项目升级开发,要将几个特殊的jsp过滤掉(也就是不做登陆验证),重写的match() 打断点没有执行,但是过滤器可以拦截未登陆的页面,并跳转到登录页面,怎么回事?并且我检查项目中nutz的其他拦截方式,都没有使用,比如 @IocBean ,@Filters(@By(type=CheckSession.class, args={"username", "/login.jsp"})) 等都没有使用,高手指点一下。

public class SecurityFilter implements ActionFilter{

private static final Log log = Logs.getLog(SecurityFilter.class);
private String funcId ; 

public SecurityFilter(String funcId){
    this.funcId = funcId;
}

public View match(ActionContext ac) {
    Master m=BaseModule.getMaster(ac.getRequest());
    String module=ac.getModule().getClass().getSimpleName();
    String pojo=module.substring(0,module.length()-6).toLowerCase();
    if(m!=null){
       boolean flg = false;
       Map<String,Menu> map = (Map<String, Menu>) Lang.collection2map(HashMap.class, m.getRole().getMenus(), "id");
         if(map.get(Sys.get(pojo))!=null){
          String cid=ac.getRequest().getParameter("cid");
          if("article".equals(pojo)&&cid!=null){
              RoleCatalog rc=m.getRole().getRcs().get(cid);
              if(rc!=null&&(Integer)Lang.obj2map(rc).get(funcId)==0){
                 return null;
              }else{
                 return new ViewWrapper(new JspView("/manage/error.jsp"),"对不起,您没有此功能的权限,请联系管理员!!!");
              }
          }else
              return null;
         }else{
          return new ViewWrapper(new JspView("/manage/error.jsp"),"对不起,您没有此功能的权限,请联系管理员!!!");
       }
    }else{
       return new ViewWrapper(new JspView("/manage/login.jsp"), null); 
    }
}

}

2 回复

你是要拦截访问jsp页面的请求,对吗?

我是想把指定的几个jsp不做拦截,找到了,老系统尽然在公共的jsp中拦截的。不过还是感谢wendal

添加回复
请先登陆
回到顶部