Class LayoutSupportingExceptionHandlerExceptionResolver

java.lang.Object
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver
org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver
com.foreach.across.modules.web.template.LayoutSupportingExceptionHandlerExceptionResolver
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, org.springframework.web.servlet.HandlerExceptionResolver

public class LayoutSupportingExceptionHandlerExceptionResolver extends org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver
Adds layout logic to the ExceptionHandlerExceptionResolver. If an exception occurs, the WebResourceRegistry will be reset and - if one is defined - a WebTemplateProcessor will be detected and reapplied for the exception handler.

This facilitates annotating ExceptionHandler methods, or their owning Controller or ControllerAdvice, with a Template.

Note that in some cases, this means WebTemplateInterceptor.preHandle(HttpServletRequest, HttpServletResponse, Object) will be invoked twice for the same template. Once by the original request and the second time by this resolver while invoking the applicable ExceptionHandler.

Since:
1.1.1
Author:
Niels Doucet, Arne Vandamme
See Also:
  • 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

    Constructors
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.springframework.web.servlet.ModelAndView
    doResolveHandlerMethodException(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, Exception exception)
     
    protected org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod
    getExceptionHandlerMethod(org.springframework.web.method.HandlerMethod handlerMethod, Exception exception)
     
    void
     
    void
     

    Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver

    afterPropertiesSet, getApplicationContext, getArgumentResolvers, getContentNegotiationManager, getCustomArgumentResolvers, getCustomReturnValueHandlers, getDefaultArgumentResolvers, getDefaultReturnValueHandlers, getExceptionHandlerAdviceCache, getMessageConverters, getReturnValueHandlers, hasGlobalExceptionHandlers, setApplicationContext, setArgumentResolvers, setContentNegotiationManager, setCustomArgumentResolvers, setCustomReturnValueHandlers, setMessageConverters, setResponseBodyAdvice, setReturnValueHandlers, shouldApplyTo

    Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver

    doResolveException

    Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver

    addMappedHandlerClass, buildLogMessage, getMappedHandlerClasses, getOrder, hasHandlerMappings, logException, prepareResponse, preventCaching, resolveException, setMappedHandlerClasses, setMappedHandlerPredicate, setMappedHandlers, setOrder, setPreventResponseCaching, setWarnLogCategory

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LayoutSupportingExceptionHandlerExceptionResolver

      public LayoutSupportingExceptionHandlerExceptionResolver()
  • Method Details

    • setWebTemplateInterceptor

      public void setWebTemplateInterceptor(WebTemplateInterceptor webTemplateInterceptor)
    • setWebResourceRegistryInterceptor

      public void setWebResourceRegistryInterceptor(WebResourceRegistryInterceptor webResourceRegistryInterceptor)
    • doResolveHandlerMethodException

      protected org.springframework.web.servlet.ModelAndView doResolveHandlerMethodException(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.web.method.HandlerMethod handlerMethod, Exception exception)
      Overrides:
      doResolveHandlerMethodException in class org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver
    • getExceptionHandlerMethod

      protected org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod getExceptionHandlerMethod(org.springframework.web.method.HandlerMethod handlerMethod, Exception exception)
      Overrides:
      getExceptionHandlerMethod in class org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver