NutzCN Logo
问答 自定义一个拦截器filter,判断user是否存在,但是uuid 没接到值?
发布于 1880天前 作者 qq_722cb381 1492 次浏览 复制 上一个帖子 下一个帖子
标签:
	@Override
	protected boolean addUUIDSessionedObject(String uuid) {
		if (Strings.isBlank(uuid)) {
			return true;
		}
		if (null == Mvcs.getReq().getSession().getAttribute(SessionKeys.API_SESSION_USER_KEY)) {

			User employee = ioc.get(IUserDao.class, "userDao").findByCondition(Cnd.where("name", "=", uuid));
			if (null == employee) {
				try {
					ResponseUtils.responseException("非法调用:不符合参数传递规则", Mvcs.getReq(), Mvcs.getResp());
					return false;
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			Mvcs.getReq().getSession().setAttribute(SessionKeys.API_SESSION_USER_KEY, employee);
			return true;
		}
		System.out.println(uuid);
		System.out.println("222");
		return true;
	}
9 回复

ActionFilter?

@wendal KopSessionKeepFilter

不晓得你的uuid哪里来的

@wendal uuid 就相当于token呗,客户端传过来需要先判断用户是否登录或是过期,但是这个值拿不到,现在是null值

你的代码体现不出uuid哪里来的

是在 get url上传的,这种能接到值吗?

http://127.0.0.1:8089/collection-show/collection/searchByName?uuid=10&key=""
@Filters({ @By(type = CheckUserFilter.class, args = "/unlogin") })

在filter里怎么能拿到uuid

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