org.springframework.ui.velocity
Class SpringResourceLoader

java.lang.Object
  extended by ResourceLoader
      extended by org.springframework.ui.velocity.SpringResourceLoader

public class SpringResourceLoader
extends 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, org.apache.velocity.runtime.resource.loader.FileResourceLoader

Field Summary
protected  Log logger
           
static java.lang.String NAME
           
private  ResourceLoader resourceLoader
           
private  java.lang.String[] resourceLoaderPaths
           
static java.lang.String SPRING_RESOURCE_LOADER
           
static java.lang.String SPRING_RESOURCE_LOADER_CACHE
           
static java.lang.String SPRING_RESOURCE_LOADER_CLASS
           
static java.lang.String SPRING_RESOURCE_LOADER_PATH
           
 
Constructor Summary
SpringResourceLoader()
           
 
Method Summary
 long getLastModified(Resource resource)
           
 java.io.InputStream getResourceStream(java.lang.String source)
           
 void init(ExtendedProperties configuration)
           
 boolean isSourceModified(Resource resource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

SPRING_RESOURCE_LOADER_CLASS

public static final java.lang.String SPRING_RESOURCE_LOADER_CLASS
See Also:
Constant Field Values

SPRING_RESOURCE_LOADER_CACHE

public static final java.lang.String SPRING_RESOURCE_LOADER_CACHE
See Also:
Constant Field Values

SPRING_RESOURCE_LOADER

public static final java.lang.String SPRING_RESOURCE_LOADER
See Also:
Constant Field Values

SPRING_RESOURCE_LOADER_PATH

public static final java.lang.String SPRING_RESOURCE_LOADER_PATH
See Also:
Constant Field Values

logger

protected final Log logger

resourceLoader

private ResourceLoader resourceLoader

resourceLoaderPaths

private java.lang.String[] resourceLoaderPaths
Constructor Detail

SpringResourceLoader

public SpringResourceLoader()
Method Detail

init

public void init(ExtendedProperties configuration)

getResourceStream

public java.io.InputStream getResourceStream(java.lang.String source)
                                      throws ResourceNotFoundException
Throws:
ResourceNotFoundException

isSourceModified

public boolean isSourceModified(Resource resource)

getLastModified

public long getLastModified(Resource resource)