/** * Template method that handles an {@link ResponseStatusException}. * <p>The default implementation delegates to {@link #applyStatusAndReason} * with the status code and reason from the exception. * @param ex the exception * @param request current HTTP request * @param response current HTTP response * @param handler the executed handler, or {@code null} if none chosen at the * time of the exception, e.g. if multipart resolution failed * @return an empty ModelAndView, i.e. exception resolved * @since 5.0 */ protected ModelAndView resolveResponseStatusException(ResponseStatusException ex, HttpServletRequest request, HttpServletResponse response, @Nullable Object handler) throws Exception { int statusCode = ex.getStatus().value(); String reason = ex.getReason(); return applyStatusAndReason(statusCode, reason, response); }
/** * Template method that handles the {@link ResponseStatus @ResponseStatus} annotation. * <p>The default implementation delegates to {@link #applyStatusAndReason} * with the status code and reason from the annotation. * @param responseStatus the {@code @ResponseStatus} annotation * @param request current HTTP request * @param response current HTTP response * @param handler the executed handler, or {@code null} if none chosen at the * time of the exception, e.g. if multipart resolution failed * @param ex the exception * @return an empty ModelAndView, i.e. exception resolved */ protected ModelAndView resolveResponseStatus(ResponseStatus responseStatus, HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) throws Exception { int statusCode = responseStatus.code().value(); String reason = responseStatus.reason(); return applyStatusAndReason(statusCode, reason, response); }
/** * Template method that handles an {@link ResponseStatusException}. * <p>The default implementation delegates to {@link #applyStatusAndReason} * with the status code and reason from the exception. * @param ex the exception * @param request current HTTP request * @param response current HTTP response * @param handler the executed handler, or {@code null} if none chosen at the * time of the exception, e.g. if multipart resolution failed * @return an empty ModelAndView, i.e. exception resolved * @since 5.0 */ protected ModelAndView resolveResponseStatusException(ResponseStatusException ex, HttpServletRequest request, HttpServletResponse response, @Nullable Object handler) throws Exception { int statusCode = ex.getStatus().value(); String reason = ex.getReason(); return applyStatusAndReason(statusCode, reason, response); }
/** * Template method that handles the {@link ResponseStatus @ResponseStatus} annotation. * <p>The default implementation delegates to {@link #applyStatusAndReason} * with the status code and reason from the annotation. * @param responseStatus the {@code @ResponseStatus} annotation * @param request current HTTP request * @param response current HTTP response * @param handler the executed handler, or {@code null} if none chosen at the * time of the exception, e.g. if multipart resolution failed * @param ex the exception * @return an empty ModelAndView, i.e. exception resolved */ protected ModelAndView resolveResponseStatus(ResponseStatus responseStatus, HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) throws Exception { int statusCode = responseStatus.code().value(); String reason = responseStatus.reason(); return applyStatusAndReason(statusCode, reason, response); }