public class GrailsExceptionResolver extends SimpleMappingExceptionResolver implements GrailsApplicationAware, ServletContextAware
Wraps any runtime exceptions with a GrailsWrappedException instance.
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
EXCEPTION_ATTRIBUTE |
|
protected static java.lang.String |
LINE_SEPARATOR |
|
protected static Log |
LOG |
|
protected AuditorAwareLookup |
auditorAwareLookup |
|
protected GrailsApplication |
grailsApplication |
|
protected ServletContext |
servletContext |
|
protected StackTraceFilterer |
stackFilterer |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
appendRequestContext(java.lang.StringBuilder sb, HttpServletRequest request)Appends optional per-request context (remote address, current auditor) to the log headline as a single parenthesised clause — e.g. |
|
protected void |
applyLogFullStackTraceOnFilter()Propagates grails.exceptionresolver.logFullStackTraceOnFilter to the
filterer instance when it is a DefaultStackTraceFilterer (or subclass
thereof). |
|
protected void |
createStackFilterer() |
|
protected java.lang.String |
determineUri(HttpServletRequest request) |
|
public 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, HttpServletRequest request, HttpServletResponse response, 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, HttpServletRequest request) |
|
public java.lang.String |
getRequestLogMessage(HttpServletRequest request) |
|
protected java.lang.String |
getRequestLogMessage(java.lang.String exceptionName, 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 |
logFullStackTraceIfEnabled(java.lang.Exception e)When the grails.exceptionresolver.logFullStackTrace property is enabled,
emits the unfiltered stack trace to the dedicated StackTrace logger.
|
|
protected void |
logStackTrace(java.lang.Exception e, HttpServletRequest request) |
|
protected UrlMappingsHolder |
lookupUrlMappings() |
|
protected UrlMappingInfo |
matchStatusCode(java.lang.Exception ex, UrlMappingsHolder urlMappings) |
|
public ModelAndView |
resolveException(HttpServletRequest request, HttpServletResponse response, java.lang.Object handler, java.lang.Exception ex) |
|
protected java.lang.String |
resolveRemoteAddr(HttpServletRequest request)Resolves the client address to include in the exception log headline. |
|
protected void |
resolveView(HttpServletRequest request, UrlMappingInfo info, ModelAndView mv) |
|
protected ModelAndView |
resolveViewOrForward(java.lang.Exception ex, UrlMappingsHolder urlMappings, HttpServletRequest request, HttpServletResponse response, ModelAndView mv) |
|
public void |
setGrailsApplication(GrailsApplication grailsApplication) |
|
public void |
setServletContext(ServletContext servletContext) |
|
protected void |
setStatus(HttpServletRequest request, HttpServletResponse response, ModelAndView mv, java.lang.Exception e) |
|
protected boolean |
shouldLogAuditor() |
|
protected boolean |
shouldLogFullStackTrace() |
|
protected boolean |
shouldLogRemoteAddr() |
Appends optional per-request context (remote address, current auditor) to the log
headline as a single parenthesised clause — e.g. (ip: 1.2.3.4, user: alice).
Emits nothing when no tokens apply, so the baseline headline format is unchanged.
Propagates grails.exceptionresolver.logFullStackTraceOnFilter to the
filterer instance when it is a DefaultStackTraceFilterer (or subclass
thereof). Custom StackTraceFilterer implementations that do not extend
the default are responsible for their own logging policy.
Obtains the root cause of the given exception
ex - The exception When the grails.exceptionresolver.logFullStackTrace property is enabled,
emits the unfiltered stack trace to the dedicated StackTrace logger.
Must be invoked before filterStackTrace(Exception) — once the
filterer calls setStackTrace(clean), the original frames are gone and
this method can only log the already-trimmed trace.
Resolves the client address to include in the exception log headline. The default
returns HttpServletRequest#getRemoteAddr()#getRemoteAddr() — the container's view of the
TCP peer, which reflects forwarded-header handling only when the servlet container
is configured to trust a proxy chain (for example Spring Boot's
server.forward-headers-strategy). Subclasses can override this to apply a
different resolution strategy; the returned value (null or empty to omit) is
appended verbatim as ip: <value>.