springSecurity拦截器Debug
UsernamePasswordAuthenticationToken authenticationToken=null;
try{
authenticationToken=getAuthentication(request);//或取请求中的Token信息
if (authenticationToken != null) {//Token令牌为null
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
} else {
ResponseUtil.out(response, Result.failed("鉴权失败"));
}
String url=request.getRequestURI();
boolean check=MetadataSource.Matcher(url);//该Matcher连接数据库匹配权限
if(check){
chain.doFilter(request,response);
}else{
ResponseUtil.out(response,Result.failed("该用户没有此权限"));
}
}catch (Exception e){
ResponseUtil.out(response, Result.failed(e.getMessage()));
}
运行到 boolean check=MetadataSource.Matcher(url); 就跳到catch(Exception e){ResponseUtil.out(response,Result.failed(e.getMessage()));}
可是e,getMessage() 是null 这是为什么?