Groovy Documentation

org.codehaus.groovy.grails.web.errors
[Java] Class GrailsExceptionResolver

java.lang.Object
  org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
      org.springframework.web.servlet.handler.SimpleMappingExceptionResolver
          org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver
All Implemented Interfaces:
org.springframework.web.context.ServletContextAware, GrailsApplicationAware

public class GrailsExceptionResolver
extends org.springframework.web.servlet.handler.SimpleMappingExceptionResolver

Wraps any runtime exceptions with a GrailsWrappedException instance.

Authors:
Graeme Rocher


Field Summary
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

 
Fields inherited from class org.springframework.web.servlet.handler.SimpleMappingExceptionResolver
DEFAULT_EXCEPTION_ATTRIBUTE, HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Fields inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Method Summary
protected void createStackFilterer()

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

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

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)

static java.lang.RuntimeException getFirstRuntimeException(java.lang.Throwable e)

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

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

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

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)

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)

void setGrailsApplication(GrailsApplication grailsApplication)

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)

 
Methods inherited from class org.springframework.web.servlet.handler.SimpleMappingExceptionResolver
org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setExceptionMappings(java.util.Properties), 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#getOrder(), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#setOrder(int), 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#resolveException(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#wait(), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#wait(long), org.springframework.web.servlet.handler.SimpleMappingExceptionResolver#wait(long, int), 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()
 
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver
org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#getOrder(), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#setOrder(int), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#setMappedHandlers(java.util.Set), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#setMappedHandlerClasses([Ljava.lang.Class;), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#setWarnLogCategory(java.lang.String), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#setPreventResponseCaching(boolean), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#resolveException(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#wait(), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#wait(long), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#wait(long, int), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#equals(java.lang.Object), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#toString(), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#hashCode(), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#getClass(), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#notify(), org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver#notifyAll()
 

Field Detail

EXCEPTION_ATTRIBUTE

public static final java.lang.String EXCEPTION_ATTRIBUTE


LINE_SEPARATOR

protected static final java.lang.String LINE_SEPARATOR


LOG

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


grailsApplication

protected GrailsApplication grailsApplication


servletContext

protected javax.servlet.ServletContext servletContext


stackFilterer

protected StackTraceFilterer stackFilterer


 
Method Detail

createStackFilterer

protected void createStackFilterer()


determineUri

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


extractLineNumber

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


filterStackTrace

protected void filterStackTrace(java.lang.Exception e)


findWrappedException

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


forwardRequest

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)


getFirstRuntimeException

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


getRequestLogMessage

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


getRequestLogMessage

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


getRequestLogMessage

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


getRootCause

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


logStackTrace

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


lookupUrlMappings

protected UrlMappingsHolder lookupUrlMappings()


matchStatusCode

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


resolveException

@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)


resolveView

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


resolveViewOrForward

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)


setGrailsApplication

public void setGrailsApplication(GrailsApplication grailsApplication)


setServletContext

public void setServletContext(javax.servlet.ServletContext servletContext)


setStatus

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


 

Groovy Documentation