提交 e4acbae2 编写于 作者: R Rossen Stoyanchev

Polish

上级 26cfe579
......@@ -29,10 +29,16 @@ import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver;
/**
* Implementation of the {@link org.springframework.web.servlet.HandlerExceptionResolver HandlerExceptionResolver}
* interface that uses the {@link ResponseStatus @ResponseStatus} annotation to map exceptions to HTTP status codes.
* A {@link org.springframework.web.servlet.HandlerExceptionResolver
* HandlerExceptionResolver} that uses the {@link ResponseStatus @ResponseStatus}
* annotation to map exceptions to HTTP status codes.
*
* <p>This exception resolver is enabled by default in the {@link org.springframework.web.servlet.DispatcherServlet}.
* <p>This exception resolver is enabled by default in the
* {@link org.springframework.web.servlet.DispatcherServlet DispatcherServlet}
* and the MVC Java config and the MVC namespace.
*
* <p>As of 4.2 this resolver also looks recursively for {@code @ResponseStatus}
* present on cause exceptions.
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
......@@ -69,16 +75,22 @@ public class ResponseStatusExceptionResolver extends AbstractHandlerExceptionRes
}
/**
* Template method that handles {@link ResponseStatus @ResponseStatus} annotation. <p>Default implementation send a
* response error using {@link HttpServletResponse#sendError(int)}, or {@link HttpServletResponse#sendError(int,
* String)} if the annotation has a {@linkplain ResponseStatus#reason() reason}. Returns an empty ModelAndView.
* Template method that handles {@link ResponseStatus @ResponseStatus} annotation.
*
* <p>Default implementation send a response error using
* {@link HttpServletResponse#sendError(int)} or
* {@link HttpServletResponse#sendError(int, String)} if the annotation has a
* {@linkplain ResponseStatus#reason() reason} and then returns an empty ModelAndView.
*
* @param responseStatus the 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
* (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution
* @return a corresponding ModelAndView to forward to, or {@code null} for default processing
* @param handler the executed handler, or {@code null} if none chosen at the
* time of the exception (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution or the
* exception that has the ResponseStatus annotation if found on the cause.
* @return a corresponding ModelAndView to forward to, or {@code null}
* for default processing
*/
protected ModelAndView resolveResponseStatus(ResponseStatus responseStatus, HttpServletRequest request,
HttpServletResponse response, Object handler, Exception ex) throws Exception {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册