|
@@ -29,16 +29,16 @@ public class WebLoginInterceptor implements HandlerInterceptor {
|
|
if (session == null || session.getAttribute("userinfo") == null) {
|
|
if (session == null || session.getAttribute("userinfo") == null) {
|
|
response.setCharacterEncoding("UTF-8");
|
|
response.setCharacterEncoding("UTF-8");
|
|
response.setContentType("application/json; charset=utf-8");
|
|
response.setContentType("application/json; charset=utf-8");
|
|
- response.getWriter().write(JSON.toJSONString(R.error().code(401).message("登录失效")));
|
|
|
|
- log.warn("登录失效");
|
|
|
|
|
|
+ byte[] bytes = JSON.toJSONString(R.error().code(401).message("登录失效")).getBytes();
|
|
|
|
+ response.getOutputStream().write(bytes);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
// 没有权限返回403
|
|
// 没有权限返回403
|
|
if (session.getAttribute("role") == null) {
|
|
if (session.getAttribute("role") == null) {
|
|
response.setCharacterEncoding("UTF-8");
|
|
response.setCharacterEncoding("UTF-8");
|
|
response.setContentType("application/json; charset=utf-8");
|
|
response.setContentType("application/json; charset=utf-8");
|
|
- response.getWriter().write(JSON.toJSONString(R.error().code(403).message("权限不足")));
|
|
|
|
- log.warn("权限不足");
|
|
|
|
|
|
+ byte[] bytes = JSON.toJSONString(R.error().code(403).message("权限不足")).getBytes();
|
|
|
|
+ response.getOutputStream().write(bytes);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
log.debug("sessionId: {}, userinfo: {}, role: {}", session.getId(),
|
|
log.debug("sessionId: {}, userinfo: {}, role: {}", session.getId(),
|