admin 管理员组文章数量: 887032
2024年1月5日发(作者:网页设计培训有哪些)
/** * 定义404的JSON数据 * @param request * @return */ @RequestMapping(value = "404") @ResponseBody public ResponseEntity
/** * 定义500的ModelAndView * @param request * @param response * @return */ @RequestMapping(produces = "text/html",value = "500") public ModelAndView errorHtml500(HttpServletRequest request, HttpServletResponse response) { tus(getStatus(request).value()); Map
/** * 定义500的错误JSON信息 * @param request * @return */ @RequestMapping(value = "500") @ResponseBody public ResponseEntity
/** * Determine if the stacktrace attribute should be included. * @param request the source request * @param produces the media type produced (or {@code }) * @return if the stacktrace attribute should be included */ protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces) { eStacktrace include = or().getIncludeStacktrace(); if (include == ) { return true; } if (include == _TRACE_PARAM) { return getTraceParameter(request); } return false; }
/** * 获取错误的信息 * @param request * @param includeStackTrace * @return */ private Map
/** * 是否包含trace * @param request * @return */ private boolean getTraceParameter(HttpServletRequest request) { String parameter = ameter("trace"); if (parameter == null) { return false; }
版权声明:本文标题:SpringBoot搭建全局异常拦截 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1704459208h460657.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论