NutzCN Logo
问答 nutz mvc,同样的方法为啥一个是302,一个是正确的返回值
发布于 2747天前 作者 binfoo 2319 次浏览 复制 上一个帖子 下一个帖子
标签:
  @At
    @Filters
    public int count() { // 统计用户数的方法,算是个测试点
        return dao.count(User.class);
    }

======这个返回正确的数字===============

  @At
    @Filters
    @Ok("raw")
    public void test() {
        System.out.println("进入test");
        Subject subject = SecurityUtils.getSubject();
        log.debug("isAuthenticated=" + subject.isAuthenticated());
        log.debug("isPermitted=" + subject.isPermitted("authority:permission:update"));
    }

================返回302=======

HEADERS
Server: Apache-Coyote/1.1
Location: /sysuser/login
Content-Length: 0
Date: Thu, 15 Jun 2017 08:57:56 GMT
raw 
 COMPLETE REQUEST HEADERS
Accept:		*/*
Accept-Encoding:		gzip, deflate
Accept-Language:		zh-CN,zh;q=0.8
Content-Type:		application/json
Cookie:		JSESSIONID=82ABF51AAB0C47C0757E427711F90F5A
Origin:		chrome-extension://aejoelaoggembcahagimdiliamlcdmfm
User-Agent:		Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8
Content-Type: application/json
Cookie: JSESSIONID=82ABF51AAB0C47C0757E427711F90F5A
Origin: chrome-extension://aejoelaoggembcahagimdiliamlcdmfm
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36

7 回复

shiro.ini 拦截了吧

嗯,看样子是被拦截,但是我加了@Filters

我的count为什么没有被拦截呢

shiro.ini是ShiroFilter处理的,在NutFilter之前就被拦截了.

干掉相关urls配置不就好了?

/sysuser/logout = logout
/sysuser/error = anon
/sysuser/count = anon

好象是的,anon的意思就是不进行拦截?

ok,谢谢。。

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