| java.lang.Object org.apache.velocity.app.event.implement.ReportInvalidReferences
ReportInvalidReferences | public class ReportInvalidReferences implements InvalidReferenceEventHandler,RuntimeServicesAware(Code) | | Use this event handler to flag invalid references. Since this
is intended to be used for a specific request, this should be
used as a local event handler attached to a specific context
instead of being globally defined in the Velocity properties file.
Note that InvalidReferenceHandler can be used
in two modes. If the Velocity properties file contains the following:
eventhandler.invalidreference.exception = true
then the event handler will throw a ParseErrorRuntimeException upon
hitting the first invalid reference. This stops processing and is
passed through to the application code. The ParseErrorRuntimeException
contain information about the template name, line number, column number,
and invalid reference.
If this configuration setting is false or omitted then the page
will be processed as normal, but all invalid references will be collected
in a List of InvalidReferenceInfo objects.
This feature should be regarded as experimental.
author: Will Glass-Husain version: $Id: ReportInvalidReferences.java 470265 2006-11-02 07:45:02Z wglass $ |
Method Summary | |
public List | getInvalidReferences() All invalid references during the processing of this page. | public Object | invalidGetMethod(Context context, String reference, Object object, String property, Info info) Collect the error and/or throw an exception, depending on configuration. | public Object | invalidMethod(Context context, String reference, Object object, String method, Info info) Collect the error and/or throw an exception, depending on configuration. | public boolean | invalidSetMethod(Context context, String leftreference, String rightreference, Info info) Collect the error and/or throw an exception, depending on configuration. | public void | setRuntimeServices(RuntimeServices rs) Called automatically when event cartridge is initialized. |
EVENTHANDLER_INVALIDREFERENCE_EXCEPTION | final public static String EVENTHANDLER_INVALIDREFERENCE_EXCEPTION(Code) | | |
invalidReferences | List invalidReferences(Code) | | List of InvalidReferenceInfo objects
|
getInvalidReferences | public List getInvalidReferences()(Code) | | All invalid references during the processing of this page.
a List of InvalidReferenceInfo objects |
invalidGetMethod | public Object invalidGetMethod(Context context, String reference, Object object, String property, Info info)(Code) | | Collect the error and/or throw an exception, depending on configuration.
Parameters: context - the context when the reference was found invalid Parameters: reference - string with complete invalid reference Parameters: object - the object referred to, or null if not found Parameters: property - the property name from the reference Parameters: info - contains template, line, column details always returns null throws: ParseErrorException - |
invalidMethod | public Object invalidMethod(Context context, String reference, Object object, String method, Info info)(Code) | | Collect the error and/or throw an exception, depending on configuration.
Parameters: context - the context when the reference was found invalid Parameters: reference - complete invalid reference Parameters: object - the object referred to, or null if not found Parameters: method - the property name from the reference Parameters: info - contains template, line, column details always returns null throws: ParseErrorException - |
invalidSetMethod | public boolean invalidSetMethod(Context context, String leftreference, String rightreference, Info info)(Code) | | Collect the error and/or throw an exception, depending on configuration.
Parameters: context - the context when the reference was found invalid Parameters: leftreference - left reference being assigned to Parameters: rightreference - invalid reference on the right Parameters: info - contains info on template, line, col loop to end -- always returns false |
setRuntimeServices | public void setRuntimeServices(RuntimeServices rs)(Code) | | Called automatically when event cartridge is initialized.
Parameters: rs - RuntimeServices object assigned during initialization |
|
|