Package com.spun.util.velocity
Class ServletContextLoader
java.lang.Object
org.apache.velocity.runtime.resource.loader.ResourceLoader
com.spun.util.velocity.ServletContextLoader
public class ServletContextLoader
extends org.apache.velocity.runtime.resource.loader.ResourceLoader
-
Field Summary
Fields Modifier and Type Field Description protected String[]pathsThe root paths for templates (relative to webapp's root).protected static javax.servlet.ServletContextservletContextFields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
className, isCachingOn, log, modificationCheckInterval, rsvc -
Constructor Summary
Constructors Constructor Description ServletContextLoader() -
Method Summary
Modifier and Type Method Description longgetLastModified(org.apache.velocity.runtime.resource.Resource resource)Defaults to return 0InputStreamgetResourceStream(String name)Get an InputStream so that the Runtime can build a template with it.voidinit(org.apache.commons.collections.ExtendedProperties configuration)This is abstract in the base class, so we need it.booleanisSourceModified(org.apache.velocity.runtime.resource.Resource resource)Defaults to return false.static voidregisterServletContext(javax.servlet.ServletContext servletContext)Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval
-
Field Details
-
paths
The root paths for templates (relative to webapp's root). -
servletContext
protected static javax.servlet.ServletContext servletContext
-
-
Constructor Details
-
ServletContextLoader
public ServletContextLoader()
-
-
Method Details
-
init
public void init(org.apache.commons.collections.ExtendedProperties configuration)This is abstract in the base class, so we need it.
NOTE: this expects that the ServletContext has already been placed in the runtime's application attributes under its full class name (i.e. "javax.servlet.ServletContext").- Specified by:
initin classorg.apache.velocity.runtime.resource.loader.ResourceLoader- Parameters:
configuration- theExtendedPropertiesassociated with this resource loader.
-
getResourceStream
public InputStream getResourceStream(String name) throws org.apache.velocity.exception.ResourceNotFoundExceptionGet an InputStream so that the Runtime can build a template with it.- Specified by:
getResourceStreamin classorg.apache.velocity.runtime.resource.loader.ResourceLoader- Parameters:
name- name of template to get- Returns:
- InputStream containing the template
- Throws:
org.apache.velocity.exception.ResourceNotFoundException- if template not found in classpath.
-
isSourceModified
public boolean isSourceModified(org.apache.velocity.runtime.resource.Resource resource)Defaults to return false.- Specified by:
isSourceModifiedin classorg.apache.velocity.runtime.resource.loader.ResourceLoader
-
getLastModified
public long getLastModified(org.apache.velocity.runtime.resource.Resource resource)Defaults to return 0- Specified by:
getLastModifiedin classorg.apache.velocity.runtime.resource.loader.ResourceLoader
-
registerServletContext
public static void registerServletContext(javax.servlet.ServletContext servletContext)
-