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

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

public class IncludeNotFound
extends Object
implements IncludeEventHandler, RuntimeServicesAware

Simple event handler that checks to see if an included page is available. If not, it includes a designated replacement page instead.

By default, the name of the replacement page is "notfound.vm", however this page name can be changed by setting the Velocity property eventhandler.include.notfound, for example:

 eventhandler.include.notfound = error.vm
 

Version:
$Id: IncludeNotFound.java 383711 2006-03-07 00:01:00Z nbubna $
Author:
Will Glass-Husain

Constructor Summary
IncludeNotFound()
           
 
Method Summary
 String includeEvent(String includeResourcePath, String currentResourcePath, String directiveName)
          Chseck to see if included file exists, and display "not found" page if it doesn't.
 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

IncludeNotFound

public IncludeNotFound()
Method Detail

includeEvent

public String includeEvent(String includeResourcePath,
                           String currentResourcePath,
                           String directiveName)
Chseck to see if included file exists, and display "not found" page if it doesn't. If "not found" page does not exist, log an error and return null.

Specified by:
includeEvent in interface IncludeEventHandler
Parameters:
includeResourcePath - the path as given in the include directive.
currentResourcePath - the path of the currently rendering template that includes the include directive.
directiveName - name of the directive used to include the resource. (With the standard directives this is either "parse" or "include").
Returns:
a new resource path for the directive, or null to block the include from occurring.

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.