springboot拦截器返回json数据给前端


if(StringUtils.isEmpty(token)){
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
PrintWriter out = null;
JSONObject res = new JSONObject();
res.put("success", false);
res.put("message", "请携带token");
out = response.getWriter();
out.append(res.toString());
return false;
}
 
posted @ 2020-02-24 13:42  阿豪吖  阅读(6075)  评论(0编辑  收藏  举报