public class ExceptionToMailResolver
extends org.springframework.web.servlet.handler.SimpleMappingExceptionResolver
<bean class="com.foreach.web.logging.ExceptionToMailResolver">
<property name="fromAddress" value="${errormail.from}"/>
<property name="toAddress" value="${erromail.to}"/>
<property name="order" value="1"/>
<property name="exceptionMappings">
<props>
<prop key="java.lang.Throwable">error</prop>
</props>
</property>
<property name="mailService" ref="mailService"/>
<property name="applicationContextInfo" ref="applicationContext"/>
</bean>
When you create an instance, following properties are mandatory:
| Constructor and Description |
|---|
ExceptionToMailResolver() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.web.servlet.ModelAndView |
doResolveException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler,
Exception ex) |
protected org.slf4j.Logger |
getLogger()
Get the logger
|
void |
setApplicationContext(com.foreach.common.spring.context.ApplicationContextInfo context)
set the ApplicationContextInfo object holding the properties of current running application
|
void |
setFromAddress(String fromAddress)
Specify from email address
|
protected void |
setLogger(org.slf4j.Logger logger)
Specify your own custom logger
|
void |
setMailService(com.foreach.common.spring.mail.MailService mailService)
set the mail service, which actually sends the exception mail
|
void |
setToAddress(String toAddress)
Specify to email address
|
addStatusCode, applyStatusCodeIfPossible, determineStatusCode, determineViewName, findMatchingViewName, getDepth, getModelAndView, getModelAndView, getStatusCodesAsMap, setDefaultErrorView, setDefaultStatusCode, setExceptionAttribute, setExceptionMappings, setExcludedExceptions, setStatusCodesbuildLogMessage, getOrder, logException, prepareResponse, preventCaching, resolveException, setMappedHandlerClasses, setMappedHandlers, setOrder, setPreventResponseCaching, setWarnLogCategory, shouldApplyToprotected final void setLogger(org.slf4j.Logger logger)
logger - protected final org.slf4j.Logger getLogger()
public final void setFromAddress(String fromAddress)
fromAddress - public final void setToAddress(String toAddress)
toAddress - public final void setMailService(com.foreach.common.spring.mail.MailService mailService)
mailService - public final void setApplicationContext(com.foreach.common.spring.context.ApplicationContextInfo context)
context - public final org.springframework.web.servlet.ModelAndView doResolveException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object handler,
Exception ex)
doResolveException in class org.springframework.web.servlet.handler.SimpleMappingExceptionResolverCopyright © 2020. All rights reserved.