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[]
    The root paths for templates (relative to webapp's root).
    protected static jakarta.servlet.ServletContext
     

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

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    getLastModified(org.apache.velocity.runtime.resource.Resource resource)
    Defaults to return 0
    getResourceReader(String source, String encoding)
    Get an InputStream so that the Runtime can build a template with it.
    void
    init(org.apache.velocity.util.ExtProperties configuration)
    This is abstract in the base class, so we need it.
    boolean
    isSourceModified(org.apache.velocity.runtime.resource.Resource resource)
    Defaults to return false.
    static void
    registerServletContext(jakarta.servlet.ServletContext servletContext)
     

    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
  • Field Details

    • paths

      protected String[] paths
      The root paths for templates (relative to webapp's root).
    • servletContext

      protected static jakarta.servlet.ServletContext servletContext
  • Constructor Details

    • ServletContextLoader

      public ServletContextLoader()
  • Method Details

    • init

      public void init(org.apache.velocity.util.ExtProperties 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:
      init in class org.apache.velocity.runtime.resource.loader.ResourceLoader
      Parameters:
      configuration - the ExtProperties associated with this resource loader.
    • getResourceReader

      public Reader getResourceReader(String source, String encoding)
      Get an InputStream so that the Runtime can build a template with it.
      Specified by:
      getResourceReader in class org.apache.velocity.runtime.resource.loader.ResourceLoader
      Parameters:
      source - name of template to get
      Returns:
      InputStream containing the template
    • isSourceModified

      public boolean isSourceModified(org.apache.velocity.runtime.resource.Resource resource)
      Defaults to return false.
      Specified by:
      isSourceModified in class org.apache.velocity.runtime.resource.loader.ResourceLoader
    • getLastModified

      public long getLastModified(org.apache.velocity.runtime.resource.Resource resource)
      Defaults to return 0
      Specified by:
      getLastModified in class org.apache.velocity.runtime.resource.loader.ResourceLoader
    • registerServletContext

      public static void registerServletContext(jakarta.servlet.ServletContext servletContext)