码迷,mamicode.com
首页 > 编程语言 > 详细

springboot-自定义异常处理器

时间:2018-09-26 17:09:17      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:result   resolve   eth   app   cep   char   lex   err   enc   

@Order(-1000)
public class LocalExceptionResolver implements HandlerExceptionResolver {

@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
Exception ex) {
return new ModelAndView();
}

private void responseResult(HttpServletResponse response, AppData result) {
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-type", "application/json;charset=UTF-8");
response.setStatus(200);
try {
response.getWriter().write(JSON.toJSONString(result));
} catch (IOException ex) {
}
}

}

springboot-自定义异常处理器

标签:result   resolve   eth   app   cep   char   lex   err   enc   

原文地址:https://www.cnblogs.com/lichangyunnianxue/p/9707658.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!