public class SpringResourceLoader extends ResourceLoader
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.
VelocityEngineFactory.setResourceLoaderPath(java.lang.String)
,
ResourceLoader
,
FileResourceLoader
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
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 |
className, isCachingOn, log, modificationCheckInterval, rsvc
Constructor and Description |
---|
SpringResourceLoader() |
Modifier and Type | Method and Description |
---|---|
long |
getLastModified(Resource resource)
Get the last modified time of the InputStream source
that was used to create the template.
|
Reader |
getResourceReader(String source,
String encoding)
Get the Reader that the Runtime will parse
to create a template.
|
void |
init(ExtProperties configuration)
Initialize the template loader with a
a resources class.
|
boolean |
isSourceModified(Resource resource)
Given a template, check to see if the source of InputStream
has been modified.
|
buildReader, commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval
public static final String NAME
public static final String SPRING_RESOURCE_LOADER_CLASS
public static final String SPRING_RESOURCE_LOADER_CACHE
public static final String SPRING_RESOURCE_LOADER
public static final String SPRING_RESOURCE_LOADER_PATH
protected final org.slf4j.Logger logger
public void init(ExtProperties configuration)
ResourceLoader
init
in class ResourceLoader
public Reader getResourceReader(String source, String encoding) throws ResourceNotFoundException
getResourceReader
in class ResourceLoader
source
- resource nameencoding
- resource encodingResourceNotFoundException
public boolean isSourceModified(Resource resource)
ResourceLoader
isSourceModified
in class ResourceLoader
public long getLastModified(Resource resource)
ResourceLoader
getLastModified
in class ResourceLoader
Copyright © 2000–2021 The Apache Software Foundation. All rights reserved.