Package: org.grails.web.errors

## [Java] Class GrailsExceptionResolver

- org.grails.web.errors.GrailsExceptionResolver

- All Implemented Interfaces and Traits:
    GrailsApplicationAware, org.springframework.web.context.ServletContextAware

      public class GrailsExceptionResolver
      extends org.springframework.web.servlet.handler.SimpleMappingExceptionResolver
      implements GrailsApplicationAware, org.springframework.web.context.ServletContextAware

  Wraps any runtime exceptions with a GrailsWrappedException instance.

  Authors:
    Graeme Rocher

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static java.lang.String` | `EXCEPTION_ATTRIBUTE` |
    `protected static java.lang.String` | `LINE_SEPARATOR` |
    `protected static org.apache.commons.logging.Log` | `LOG` |
    `protected GrailsApplication` | `grailsApplication` |
    `protected javax.servlet.ServletContext` | `servletContext` |
    `protected StackTraceFilterer` | `stackFilterer` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class org.springframework.web.servlet.handler.SimpleMappingExceptionResolver` | `DEFAULT_EXCEPTION_ATTRIBUTE, HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected void` | `createStackFilterer()`
    `` | `protected java.lang.String` | `determineUri(javax.servlet.http.HttpServletRequest request)`
    `` | `public static int` | `extractLineNumber(org.codehaus.groovy.control.CompilationFailedException e)`
    `` | `java.util.Map` | `extractRequestParamsWithUrlMappingHolder(UrlMappingsHolder urlMappings, javax.servlet.http.HttpServletRequest request)`
    `` | `protected void` | `filterStackTrace(java.lang.Exception e)`
    `` | `protected java.lang.Exception` | `findWrappedException(java.lang.Exception e)`
    `` | `protected void` | `forwardRequest(UrlMappingInfo info, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.servlet.ModelAndView mv, java.lang.String uri)`
    `` | `public static java.lang.RuntimeException` | `getFirstRuntimeException(java.lang.Throwable e)`
    `` | `public java.lang.String` | `getRequestLogMessage(java.lang.Throwable e, javax.servlet.http.HttpServletRequest request)`
    `` | `public java.lang.String` | `getRequestLogMessage(javax.servlet.http.HttpServletRequest request)`
    `` | `protected java.lang.String` | `getRequestLogMessage(java.lang.String exceptionName, javax.servlet.http.HttpServletRequest request, java.lang.String message)`
    `` | `public static java.lang.Throwable` | `getRootCause(java.lang.Throwable ex)` Obtains the root cause of the given exception
    `` | `protected void` | `logStackTrace(java.lang.Exception e, javax.servlet.http.HttpServletRequest request)`
    `` | `protected UrlMappingsHolder` | `lookupUrlMappings()`
    `` | `protected UrlMappingInfo` | `matchStatusCode(java.lang.Exception ex, UrlMappingsHolder urlMappings)`
    `` | `public org.springframework.web.servlet.ModelAndView` | `resolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, java.lang.Exception ex)`
    `` | `protected void` | `resolveView(javax.servlet.http.HttpServletRequest request, UrlMappingInfo info, org.springframework.web.servlet.ModelAndView mv)`
    `` | `protected org.springframework.web.servlet.ModelAndView` | `resolveViewOrForward(java.lang.Exception ex, UrlMappingsHolder urlMappings, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.servlet.ModelAndView mv)`
    `` | `public void` | `setGrailsApplication(GrailsApplication grailsApplication)`
    `` | `public void` | `setServletContext(javax.servlet.ServletContext servletContext)`
    `` | `protected void` | `setStatus(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.servlet.ModelAndView mv, java.lang.Exception e)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class org.springframework.web.servlet.handler.SimpleMappingExceptionResolver` | `org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setExcludedExceptions([Ljava.lang.Class;), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setDefaultErrorView(java.lang.String), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setStatusCodes(java.util.Properties), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#addStatusCode(java.lang.String, int), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#getStatusCodesAsMap(), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setDefaultStatusCode(int), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setExceptionAttribute(java.lang.String), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setExceptionMappings(java.util.Properties), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setMappedHandlers(java.util.Set), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setMappedHandlerClasses([Ljava.lang.Class;), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setWarnLogCategory(java.lang.String), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setPreventResponseCaching(boolean), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#getOrder(), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setOrder(int), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#resolveException(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#wait(long), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#wait(long, int), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#wait(), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#equals(java.lang.Object), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#toString(), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#hashCode(), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#getClass(), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#notify(), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#notifyAll()`

- - ### Field Detail

    - #### public static final java.lang.String EXCEPTION_ATTRIBUTE

    - #### protected static final java.lang.String LINE_SEPARATOR

    - #### protected static final org.apache.commons.logging.Log LOG

    - #### protected GrailsApplication grailsApplication

    - #### protected javax.servlet.ServletContext servletContext

    - #### protected StackTraceFilterer stackFilterer

  - ### Method Detail

    - #### protected void createStackFilterer()

    - #### protected java.lang.String determineUri(javax.servlet.http.HttpServletRequest request)

    - #### public static int extractLineNumber(org.codehaus.groovy.control.CompilationFailedException e)

    - #### java.util.Map extractRequestParamsWithUrlMappingHolder(UrlMappingsHolder urlMappings, javax.servlet.http.HttpServletRequest request)

    - #### protected void filterStackTrace(java.lang.Exception e)

    - #### protected java.lang.Exception findWrappedException(java.lang.Exception e)

    - #### protected void forwardRequest(UrlMappingInfo info, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.servlet.ModelAndView mv, java.lang.String uri)

    - #### public static java.lang.RuntimeException getFirstRuntimeException(java.lang.Throwable e)

    - #### public java.lang.String getRequestLogMessage(java.lang.Throwable e, javax.servlet.http.HttpServletRequest request)

    - #### public java.lang.String getRequestLogMessage(javax.servlet.http.HttpServletRequest request)

    - #### protected java.lang.String getRequestLogMessage(java.lang.String exceptionName, javax.servlet.http.HttpServletRequest request, java.lang.String message)

    - #### public static java.lang.Throwable getRootCause(java.lang.Throwable ex)

      Obtains the root cause of the given exception

      Parameters:
        `ex` - The exception
      Returns:
        The root cause

    - #### protected void logStackTrace(java.lang.Exception e, javax.servlet.http.HttpServletRequest request)

    - #### protected UrlMappingsHolder lookupUrlMappings()

    - #### protected UrlMappingInfo matchStatusCode(java.lang.Exception ex, UrlMappingsHolder urlMappings)

    - #### @java.lang.Override public org.springframework.web.servlet.ModelAndView resolveException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object handler, java.lang.Exception ex)

    - #### protected void resolveView(javax.servlet.http.HttpServletRequest request, UrlMappingInfo info, org.springframework.web.servlet.ModelAndView mv)

    - #### protected org.springframework.web.servlet.ModelAndView resolveViewOrForward(java.lang.Exception ex, UrlMappingsHolder urlMappings, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.servlet.ModelAndView mv)

    - #### public void setGrailsApplication(GrailsApplication grailsApplication)

    - #### public void setServletContext(javax.servlet.ServletContext servletContext)

    - #### protected void setStatus(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.web.servlet.ModelAndView mv, java.lang.Exception e)