FileDocCategorySizeDatePackage
ExceptionInterceptor.javaAPI DocExample1082Mon Apr 25 12:05:22 BST 2005com.springbook.interceptors

ExceptionInterceptor

public class ExceptionInterceptor extends Object implements org.springframework.aop.ThrowsAdvice

Fields Summary
private org.springframework.mail.MailSender
mailSender
private org.springframework.mail.SimpleMailMessage
mailMessage
Constructors Summary
Methods Summary
public voidafterThrowing(java.lang.reflect.Method m, java.lang.Object[] args, java.lang.Object target, java.lang.Exception ex)

        try {
         mailMessage.setText(ex.getMessage());
         mailSender.send(mailMessage);
        } catch (Exception mex) {
           // handle mail error
           System.out.println("ERROR SENDING MAIL: " + mex.getMessage());
        }
     
public org.springframework.mail.SimpleMailMessagegetMailMessage()

      return mailMessage;
   
public org.springframework.mail.MailSendergetMailSender()

      return mailSender;
   
public voidsetMailMessage(org.springframework.mail.SimpleMailMessage mailMessage)

      this.mailMessage = mailMessage;
   
public voidsetMailSender(org.springframework.mail.MailSender mailSender)

      this.mailSender = mailSender;