|
spring-webmvc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver
org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver
public class ExceptionHandlerExceptionResolver
An AbstractHandlerMethodExceptionResolver
that resolves exceptions
through @ExceptionHandler
methods.
Support for custom argument and return value types can be added via
setCustomArgumentResolvers(java.util.List
and setCustomReturnValueHandlers(java.util.List
.
Or alternatively to re-configure all argument and return value types use
setArgumentResolvers(java.util.List
and setReturnValueHandlers(List)
.
Field Summary |
---|
Fields inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver |
---|
logger |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
ExceptionHandlerExceptionResolver()
Default constructor. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
protected ModelAndView |
doResolveHandlerMethodException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.web.method.HandlerMethod handlerMethod,
java.lang.Exception exception)
Find an @ ExceptionHandler method and invoke it to handle the
raised exception. |
org.springframework.web.method.support.HandlerMethodArgumentResolverComposite |
getArgumentResolvers()
Return the configured argument resolvers, or possibly null if
not initialized yet via afterPropertiesSet() . |
java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> |
getCustomArgumentResolvers()
Return the custom argument resolvers, or null . |
java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> |
getCustomReturnValueHandlers()
Return the custom return value handlers, or null . |
protected java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> |
getDefaultArgumentResolvers()
Return the list of argument resolvers to use including built-in resolvers and custom resolvers provided via setCustomArgumentResolvers(java.util.List . |
protected java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> |
getDefaultReturnValueHandlers()
Return the list of return value handlers to use including built-in and custom handlers provided via setReturnValueHandlers(java.util.List . |
protected ServletInvocableHandlerMethod |
getExceptionHandlerMethod(org.springframework.web.method.HandlerMethod handlerMethod,
java.lang.Exception exception)
Find the @ ExceptionHandler method for the given exception. |
java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> |
getMessageConverters()
Return the configured message body converters. |
org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite |
getReturnValueHandlers()
Return the configured handlers, or possibly null if not
initialized yet via afterPropertiesSet() . |
void |
setArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> argumentResolvers)
Configure the complete list of supported argument types thus overriding the resolvers that would otherwise be configured by default. |
void |
setCustomArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> argumentResolvers)
Provide resolvers for custom argument types. |
void |
setCustomReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> returnValueHandlers)
Provide handlers for custom return value types. |
void |
setMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
Set the message body converters to use. |
void |
setReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> returnValueHandlers)
Configure the complete list of supported return value types thus overriding handlers that would otherwise be configured by default. |
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver |
---|
doResolveException, shouldApplyTo |
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver |
---|
buildLogMessage, getOrder, logException, prepareResponse, preventCaching, resolveException, setMappedHandlerClasses, setMappedHandlers, setOrder, setPreventResponseCaching, setWarnLogCategory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExceptionHandlerExceptionResolver()
Method Detail |
---|
public void setCustomArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> argumentResolvers)
setArgumentResolvers(java.util.List)
instead.
public java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> getCustomArgumentResolvers()
null
.
public void setArgumentResolvers(java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> argumentResolvers)
public org.springframework.web.method.support.HandlerMethodArgumentResolverComposite getArgumentResolvers()
null
if
not initialized yet via afterPropertiesSet()
.
public void setCustomReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> returnValueHandlers)
setReturnValueHandlers(java.util.List)
.
public java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> getCustomReturnValueHandlers()
null
.
public void setReturnValueHandlers(java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> returnValueHandlers)
public org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite getReturnValueHandlers()
null
if not
initialized yet via afterPropertiesSet()
.
public void setMessageConverters(java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
These converters are used to convert from and to HTTP requests and responses.
public java.util.List<org.springframework.http.converter.HttpMessageConverter<?>> getMessageConverters()
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
protected java.util.List<org.springframework.web.method.support.HandlerMethodArgumentResolver> getDefaultArgumentResolvers()
setCustomArgumentResolvers(java.util.List)
.
protected java.util.List<org.springframework.web.method.support.HandlerMethodReturnValueHandler> getDefaultReturnValueHandlers()
setReturnValueHandlers(java.util.List)
.
protected ModelAndView doResolveHandlerMethodException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, java.lang.Exception exception)
ExceptionHandler
method and invoke it to handle the
raised exception.
doResolveHandlerMethodException
in class AbstractHandlerMethodExceptionResolver
request
- current HTTP requestresponse
- current HTTP responsehandlerMethod
- the executed handler method, or null
if none chosen at the time
of the exception (for example, if multipart resolution failed)exception
- the exception that got thrown during handler execution
null
for default processingprotected ServletInvocableHandlerMethod getExceptionHandlerMethod(org.springframework.web.method.HandlerMethod handlerMethod, java.lang.Exception exception)
ExceptionHandler
method for the given exception.
The default implementation searches @ExceptionHandler
methods
in the class hierarchy of the method that raised the exception.
handlerMethod
- the method where the exception was raised, possibly null
exception
- the raised exception
null
|
spring-webmvc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |