org.springframework.web.servlet.mvc.annotation
Class ResponseStatusExceptionResolver
java.lang.Object
   org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
       org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver
org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver
- All Implemented Interfaces: 
- Ordered, HandlerExceptionResolver
- public class ResponseStatusExceptionResolver 
- extends AbstractHandlerExceptionResolver
Implementation of the HandlerExceptionResolver
 interface that uses the @ResponseStatus annotation to map exceptions to HTTP status codes.
 
This exception resolver is enabled by default in the DispatcherServlet.
- Since:
- 3.0
- Author:
- Arjen Poutsma
 
 
 
 
 
| Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver | 
| buildLogMessage, getOrder, logException, prepareResponse, preventCaching, resolveException, setMappedHandlerClasses, setMappedHandlers, setOrder, setPreventResponseCaching, setWarnLogCategory, shouldApplyTo | 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
ResponseStatusExceptionResolver
public ResponseStatusExceptionResolver()
doResolveException
protected ModelAndView doResolveException(HttpServletRequest request,
                                          HttpServletResponse response,
                                          Object handler,
                                          Exception ex)
- Description copied from class: AbstractHandlerExceptionResolver
- Actually resolve the given exception that got thrown during on handler execution,
 returning a ModelAndView that represents a specific error page if appropriate.
 May be overridden in subclasses, in order to apply specific exception checks.
 Note that this template method will be invoked after checking whether this
 resolved applies ("mappedHandlers" etc), so an implementation may simply proceed
 with its actual exception handling.
 
 
- 
- Specified by:
- doResolveExceptionin class- AbstractHandlerExceptionResolver
 
- 
- Parameters:
- request- current HTTP request
- response- current HTTP response
- handler- the executed handler, or- nullif none chosen at the time
 of the exception (for example, if multipart resolution failed)
- ex- the exception that got thrown during handler execution
- Returns:
- a corresponding ModelAndView to forward to, or nullfor default processing
 
resolveResponseStatus
protected ModelAndView resolveResponseStatus(ResponseStatus responseStatus,
                                             HttpServletRequest request,
                                             HttpServletResponse response,
                                             Object handler,
                                             Exception ex)
                                      throws Exception
- Template method that handles @ResponseStatusannotation.Default implementation send a
 response error using HttpServletResponse.sendError(int), orHttpServletResponse.sendError(int,
 String)if the annotation has a reason. Returns an empty ModelAndView.
 
 
- 
- Parameters:
- responseStatus- the annotation
- request- current HTTP request
- response- current HTTP response
- handler- the executed handler, or- nullif none chosen at the time of the exception
 (for example, if multipart resolution failed)
- ex- the exception that got thrown during handler execution
- Returns:
- a corresponding ModelAndView to forward to, or nullfor default processing
- Throws:
- Exception