exception : error info
This commit is contained in:
@@ -11,15 +11,35 @@ import javax.servlet.http.HttpServletResponse;
|
||||
@Controller
|
||||
public class ErrorPageController {
|
||||
|
||||
//RequestDispatcher 상수로 정의되어 있음
|
||||
public static final String ERROR_EXCEPTION = "javax.servlet.error.exception";
|
||||
public static final String ERROR_EXCEPTION_TYPE = "javax.servlet.error.exception_type";
|
||||
public static final String ERROR_MESSAGE = "javax.servlet.error.message";
|
||||
public static final String ERROR_REQUEST_URI = "javax.servlet.error.request_uri";
|
||||
public static final String ERROR_SERVLET_NAME = "javax.servlet.error.servlet_name";
|
||||
public static final String ERROR_STATUS_CODE = "javax.servlet.error.status_code";
|
||||
|
||||
@RequestMapping("/error-page/404")
|
||||
public String errorPage404(HttpServletRequest request, HttpServletResponse response) {
|
||||
log.info("errorPage 404");
|
||||
printErrorInfo(request);
|
||||
return "error-page/404";
|
||||
}
|
||||
|
||||
@RequestMapping("/error-page/500")
|
||||
public String errorPage500(HttpServletRequest request, HttpServletResponse response) {
|
||||
log.info("errorPage 500");
|
||||
printErrorInfo(request);
|
||||
return "error-page/500";
|
||||
}
|
||||
|
||||
private void printErrorInfo(HttpServletRequest request) {
|
||||
log.info("ERROR_EXCEPTION : {}", request.getAttribute(ERROR_EXCEPTION));
|
||||
log.info("ERROR_EXCEPTION_TYPE : {}", request.getAttribute(ERROR_EXCEPTION_TYPE));
|
||||
log.info("ERROR_MESSAGE : {}", request.getAttribute(ERROR_MESSAGE));
|
||||
log.info("ERROR_REQUEST_URI : {}", request.getAttribute(ERROR_REQUEST_URI));
|
||||
log.info("ERROR_SERVLET_NAME : {}", request.getAttribute(ERROR_SERVLET_NAME));
|
||||
log.info("ERROR_STATUS_CODE : {}", request.getAttribute(ERROR_STATUS_CODE));
|
||||
log.info("dispatcherType={}", request.getDispatcherType());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user