org.apache.velocity.app.event.implement
Class PrintExceptions

java.lang.Object
  extended byorg.apache.velocity.app.event.implement.PrintExceptions
All Implemented Interfaces:
EventHandler, MethodExceptionEventHandler, RuntimeServicesAware

public class PrintExceptions
extends Object
implements MethodExceptionEventHandler, RuntimeServicesAware

Simple event handler that renders method exceptions in the page rather than throwing the exception. Useful for debugging.

By default this event handler renders the exception name only. To include both the exception name and the message, set the property eventhandler.methodexception.message to true. To render the stack trace, set the property eventhandler.methodexception.stacktrace to true.

Version:
$Id: PrintExceptions.java 345574 2005-11-18 21:11:38Z wglass $
Author:
Will Glass-Husain

Constructor Summary
PrintExceptions()
           
 
Method Summary
 Object methodException(Class claz, String method, Exception e)
          Render the method exception, and optionally the exception message and stack trace.
 void setRuntimeServices(RuntimeServices rs)
          Initialize the EventHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintExceptions

public PrintExceptions()
Method Detail

methodException

public Object methodException(Class claz,
                              String method,
                              Exception e)
                       throws Exception
Render the method exception, and optionally the exception message and stack trace.

Specified by:
methodException in interface MethodExceptionEventHandler
Parameters:
claz - the class of the object the method is being applied to
method - the method
e - the thrown exception
Returns:
an object to insert in the page
Throws:
Exception - an exception to be thrown instead inserting an object

setRuntimeServices

public void setRuntimeServices(RuntimeServices rs)
                        throws Exception
Description copied from interface: RuntimeServicesAware
Initialize the EventHandler.

Specified by:
setRuntimeServices in interface RuntimeServicesAware
Throws:
Exception


Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.