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

java.lang.Object
  extended by org.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.

Since:
1.5
Version:
$Id: PrintExceptions.java 998264 2010-09-17 19:13:02Z apetrelli $
Author:
Will Glass-Husain

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.velocity.app.event.MethodExceptionEventHandler
MethodExceptionEventHandler.MethodExceptionExecutor
 
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)
          Called automatically when event cartridge is initialized.
 
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)
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

setRuntimeServices

public void setRuntimeServices(RuntimeServices rs)
Description copied from interface: RuntimeServicesAware
Called automatically when event cartridge is initialized.

Specified by:
setRuntimeServices in interface RuntimeServicesAware
Parameters:
rs - RuntimeServices object assigned during initialization
See Also:
RuntimeServicesAware.setRuntimeServices(org.apache.velocity.runtime.RuntimeServices)


Copyright © 2000-2012 The Apache Software Foundation. All Rights Reserved.