use of com.rogge.common.model.User in project spring-cloud by Rogge666.
the class LoginInterceptor method preHandle.
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 未登录
User user = sessionUserInfo.getCurrentSessionUser(User.class);
if (user == null) {
ApiResponse apiResponse = ApiResponse.creatFail(ResponseCode.LoginRegister.NOLOGIN);
response.setContentType("application/json;charset=UTF-8");
response.getWriter().print(JSON.toJSONString(apiResponse, SerializerFeature.DisableCircularReferenceDetect, SerializerFeature.WriteEnumUsingToString));
return false;
} else {
sessionUserInfo.setSessionUser(user);
}
return true;
}
Aggregations