首页 > 其他分享 >拦截器preHandle拦截接口没有权限返回

拦截器preHandle拦截接口没有权限返回

时间:2022-11-25 09:57:09浏览次数:46  
标签:拦截器 preHandle res 接口 权限 response out

/**
* 响应信息
*
* @param response 返回信息
*/
public static void response(HttpServletResponse response) {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
PrintWriter out;
try {
JSONObject res = new JSONObject();
res.put("code", 401);
res.put("message", "访问无权限");
out = response.getWriter();
out.append(res.toString());
} catch (Exception e) {
e.printStackTrace();
}
}

标签:拦截器,preHandle,res,接口,权限,response,out
From: https://www.cnblogs.com/hjwbkcom/p/16924220.html

相关文章