SpringResourceLoader (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.ui.velocity

## Class SpringResourceLoader

- java.lang.Object
- - org.apache.velocity.runtime.resource.loader.ResourceLoader
  - - org.springframework.ui.velocity.SpringResourceLoader

-     public class SpringResourceLoader
      extends org.apache.velocity.runtime.resource.loader.ResourceLoader

  Velocity ResourceLoader adapter that loads via a Spring ResourceLoader. Used by VelocityEngineFactory for any resource loader path that cannot be resolved to a `java.io.File`.

  Note that this loader does not allow for modification detection: Use Velocity's default FileResourceLoader for `java.io.File` resources.

  Expects "spring.resource.loader" and "spring.resource.loader.path" application attributes in the Velocity runtime: the former of type `org.springframework.core.io.ResourceLoader`, the latter a String.

  Since:
    14.03.2004
  Author:
    Juergen Hoeller
  See Also:
    `VelocityEngineFactory.setResourceLoaderPath(java.lang.String)`, `ResourceLoader`, `FileResourceLoader`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Log` | `logger`
    `static String` | `NAME`
    `static String` | `SPRING_RESOURCE_LOADER`
    `static String` | `SPRING_RESOURCE_LOADER_CACHE`
    `static String` | `SPRING_RESOURCE_LOADER_CLASS`
    `static String` | `SPRING_RESOURCE_LOADER_PATH`

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

      `className, isCachingOn, log, modificationCheckInterval, rsvc`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SpringResourceLoader()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getLastModified(org.apache.velocity.runtime.resource.Resource resource)`
    `InputStream` | `getResourceStream(String source)`
    `void` | `init(org.apache.commons.collections.ExtendedProperties configuration)`
    `boolean` | `isSourceModified(org.apache.velocity.runtime.resource.Resource resource)`

    - ### Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader

      `commonInit, getClassName, getModificationCheckInterval, isCachingOn, setCachingOn, setModificationCheckInterval`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NAME

          public static final String NAME

      See Also:
        Constant Field Values

    - #### SPRING_RESOURCE_LOADER_CLASS

          public static final String SPRING_RESOURCE_LOADER_CLASS

      See Also:
        Constant Field Values

    - #### SPRING_RESOURCE_LOADER_CACHE

          public static final String SPRING_RESOURCE_LOADER_CACHE

      See Also:
        Constant Field Values

    - #### SPRING_RESOURCE_LOADER

          public static final String SPRING_RESOURCE_LOADER

      See Also:
        Constant Field Values

    - #### SPRING_RESOURCE_LOADER_PATH

          public static final String SPRING_RESOURCE_LOADER_PATH

      See Also:
        Constant Field Values

    - #### logger

          protected final Log logger

  - ### Constructor Detail

    - #### SpringResourceLoader

          public SpringResourceLoader()

  - ### Method Detail

    - #### init

          public void init(org.apache.commons.collections.ExtendedProperties configuration)

      Specified by:
        `init` in class `org.apache.velocity.runtime.resource.loader.ResourceLoader`

    - #### getResourceStream

          public InputStream getResourceStream(String source)
                                        throws org.apache.velocity.exception.ResourceNotFoundException

      Specified by:
        `getResourceStream` in class `org.apache.velocity.runtime.resource.loader.ResourceLoader`
      Throws:
        `org.apache.velocity.exception.ResourceNotFoundException`

    - #### isSourceModified

          public boolean isSourceModified(org.apache.velocity.runtime.resource.Resource resource)

      Specified by:
        `isSourceModified` in class `org.apache.velocity.runtime.resource.loader.ResourceLoader`

    - #### getLastModified

          public long getLastModified(org.apache.velocity.runtime.resource.Resource resource)

      Specified by:
        `getLastModified` in class `org.apache.velocity.runtime.resource.loader.ResourceLoader`