Class SpringResourceLoader
java.lang.Object
org.apache.velocity.runtime.resource.loader.ResourceLoader
org.springframework.web.servlet.view.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)ResourceLoaderFileResourceLoader
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.slf4j.Loggerstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
className, isCachingOn, log, modificationCheckInterval, rsvc -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetLastModified(org.apache.velocity.runtime.resource.Resource resource) getResourceStream(String source) voidinit(org.apache.commons.collections.ExtendedProperties configuration) booleanisSourceModified(org.apache.velocity.runtime.resource.Resource resource) Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval
-
Field Details
-
logger
public static final org.slf4j.Logger logger -
NAME
- See Also:
-
SPRING_RESOURCE_LOADER_CLASS
- See Also:
-
SPRING_RESOURCE_LOADER_CACHE
- See Also:
-
SPRING_RESOURCE_LOADER
- See Also:
-
SPRING_RESOURCE_LOADER_PATH
- See Also:
-
-
Constructor Details
-
SpringResourceLoader
public SpringResourceLoader()
-
-
Method Details
-
init
public void init(org.apache.commons.collections.ExtendedProperties configuration) - Specified by:
initin classorg.apache.velocity.runtime.resource.loader.ResourceLoader
-
getResourceStream
public InputStream getResourceStream(String source) throws org.apache.velocity.exception.ResourceNotFoundException - Specified by:
getResourceStreamin classorg.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:
isSourceModifiedin classorg.apache.velocity.runtime.resource.loader.ResourceLoader
-
getLastModified
public long getLastModified(org.apache.velocity.runtime.resource.Resource resource) - Specified by:
getLastModifiedin classorg.apache.velocity.runtime.resource.loader.ResourceLoader
-