Class ClasspathPathResourceLoader


  • public class ClasspathPathResourceLoader
    extends org.apache.velocity.runtime.resource.loader.ResourceLoader
    A loader for templates stored on the classpath. Treats the template as relative to the configured root path. If the root path is empty treats the template name as an absolute path.
    • Field Summary

      • Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader

        className, isCachingOn, log, modificationCheckInterval, rsvc
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getLastModified​(org.apache.velocity.runtime.resource.Resource resource)  
      java.io.Reader getResourceReader​(java.lang.String templateName, java.lang.String encoding)
      Get a Reader so that the Runtime can build a template with it.
      void init​(org.apache.velocity.util.ExtProperties configuration)  
      boolean isSourceModified​(org.apache.velocity.runtime.resource.Resource resource)  
      • Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader

        buildReader, commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClasspathPathResourceLoader

        public ClasspathPathResourceLoader()
    • Method Detail

      • init

        public void init​(org.apache.velocity.util.ExtProperties configuration)
        Specified by:
        init in class org.apache.velocity.runtime.resource.loader.ResourceLoader
        See Also:
        ResourceLoader.init(org.apache.velocity.util.ExtProperties)
      • getResourceReader

        public java.io.Reader getResourceReader​(java.lang.String templateName,
                                                java.lang.String encoding)
                                         throws org.apache.velocity.exception.ResourceNotFoundException
        Get a Reader so that the Runtime can build a template with it.
        Specified by:
        getResourceReader in class org.apache.velocity.runtime.resource.loader.ResourceLoader
        Parameters:
        name - name of template to get
        encoding - asked encoding
        Returns:
        InputStream containing the template
        Throws:
        org.apache.velocity.exception.ResourceNotFoundException - if template not found in classpath.
        Since:
        2.0
      • isSourceModified

        public boolean isSourceModified​(org.apache.velocity.runtime.resource.Resource resource)
        Specified by:
        isSourceModified in class org.apache.velocity.runtime.resource.loader.ResourceLoader
        See Also:
        ResourceLoader.isSourceModified(org.apache.velocity.runtime.resource.Resource)
      • getLastModified

        public long getLastModified​(org.apache.velocity.runtime.resource.Resource resource)
        Specified by:
        getLastModified in class org.apache.velocity.runtime.resource.loader.ResourceLoader
        See Also:
        ResourceLoader.getLastModified(org.apache.velocity.runtime.resource.Resource)