jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.exceptionhandler
Class AlertExceptionHandler

java.lang.Object
  extended byuk.co.weft.htform.ResourceConsumerImpl
      extended byuk.co.weft.exceptionhandler.AlertExceptionHandler
All Implemented Interfaces:
ExceptionHandler, ResourceConsumer

public class AlertExceptionHandler
extends ResourceConsumerImpl
implements ExceptionHandler

An exception handler which sends mail to the system administrator, and apologises to the user. This class knows about the following configuration paramater:

administrator_email_address
Email address: the email address of the entity to whom alerts should be sent in the event of an untrapped exception happening in the running system. Not optional, no default.

In addition, all the configuration parameters used by Alert should be passed.

See Also:
Alert

Field Summary
protected  InternetAddress adminEmail
          the address to sent an alert to, when an exception occurs
static java.lang.String ADMINEMAILCONFIGTOKEN
          A token on which to look in the configuration for the administrator's email address
protected  Alert sender
          the alert agent which sends alerts to the sysadmin when an exception occurs
 
Fields inherited from class uk.co.weft.htform.ResourceConsumerImpl
resourceBundleName
 
Fields inherited from interface uk.co.weft.htform.ResourceConsumer
RESOURCEBUNDLEMAGICTOKEN
 
Constructor Summary
AlertExceptionHandler()
           
 
Method Summary
 void init(Context config)
          initialise me with this configuration
 void whinge(javax.servlet.ServletOutputStream out, java.lang.Exception e, Context context)
          whinge by generating and sending mail to the system administrator
 
Methods inherited from class uk.co.weft.htform.ResourceConsumerImpl
getContextOrResource, getResource, getResourceOrContext, getResourceString, grs, grs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADMINEMAILCONFIGTOKEN

public static final java.lang.String ADMINEMAILCONFIGTOKEN
A token on which to look in the configuration for the administrator's email address

See Also:
Constant Field Values

sender

protected Alert sender
the alert agent which sends alerts to the sysadmin when an exception occurs


adminEmail

protected InternetAddress adminEmail
the address to sent an alert to, when an exception occurs

Constructor Detail

AlertExceptionHandler

public AlertExceptionHandler()
Method Detail

init

public void init(Context config)
          throws InitialisationException
Description copied from interface: ExceptionHandler
initialise me with this configuration

Specified by:
init in interface ExceptionHandler
Overrides:
init in class ResourceConsumerImpl
Throws:
InitialisationException

whinge

public void whinge(javax.servlet.ServletOutputStream out,
                   java.lang.Exception e,
                   Context context)
            throws javax.servlet.ServletException
whinge by generating and sending mail to the system administrator

Specified by:
whinge in interface ExceptionHandler
Parameters:
out - an output stream on which things can be printed to the user
e - the exception being handled
context - the context in which it's being handled
Throws:
javax.servlet.ServletException - if something even worse happens (try not to do this!)

jacquard 1.12.0 by The Web Engineering Factory and Toolworks