Module net.shibboleth.ext.spring
Class SpringResourceLoader
- java.lang.Object
-
- org.apache.velocity.runtime.resource.loader.ResourceLoader
-
- net.shibboleth.ext.spring.velocity.SpringResourceLoader
-
public class SpringResourceLoader extends org.apache.velocity.runtime.resource.loader.ResourceLoaderVelocity ResourceLoader adapter that loads via a Spring ResourceLoader. Used by VelocityEngineFactory for any resource loader path that cannot be resolved to ajava.io.File.Note that this loader does not allow for modification detection: Use Velocity's default FileResourceLoader for
java.io.Fileresources.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:
- 6.0.0
- See Also:
VelocityEngineFactory.setResourceLoaderPath(java.lang.String),ResourceLoader,FileResourceLoader
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogClass logger.static StringNAMEConstant identifying resource loader name.private ResourceLoaderresourceLoaderUnderlying Spring resource loader.private String[]resourceLoaderPathsResource loader paths.static StringSPRING_RESOURCE_LOADERConstant identifyingResourceLoaderinstance.static StringSPRING_RESOURCE_LOADER_CACHEConstant identifying caching property.static StringSPRING_RESOURCE_LOADER_CLASSConstant identifying resource loader class name.static StringSPRING_RESOURCE_LOADER_PATHConstant identifying resource loader path.
-
Constructor Summary
Constructors Constructor Description SpringResourceLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetLastModified(org.apache.velocity.runtime.resource.Resource resource)ReadergetResourceReader(String source, String encoding)voidinit(org.apache.velocity.util.ExtProperties configuration)booleanisSourceModified(org.apache.velocity.runtime.resource.Resource resource)
-
-
-
Field Detail
-
NAME
@Nonnull @NotEmpty public static final String NAME
Constant identifying resource loader name.- See Also:
- Constant Field Values
-
SPRING_RESOURCE_LOADER_CLASS
@Nonnull @NotEmpty public static final String SPRING_RESOURCE_LOADER_CLASS
Constant identifying resource loader class name.- See Also:
- Constant Field Values
-
SPRING_RESOURCE_LOADER_CACHE
@Nonnull @NotEmpty public static final String SPRING_RESOURCE_LOADER_CACHE
Constant identifying caching property.- See Also:
- Constant Field Values
-
SPRING_RESOURCE_LOADER
@Nonnull @NotEmpty public static final String SPRING_RESOURCE_LOADER
Constant identifyingResourceLoaderinstance.- See Also:
- Constant Field Values
-
SPRING_RESOURCE_LOADER_PATH
@Nonnull @NotEmpty public static final String SPRING_RESOURCE_LOADER_PATH
Constant identifying resource loader path.- See Also:
- Constant Field Values
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
resourceLoader
@Nullable private ResourceLoader resourceLoader
Underlying Spring resource loader.
-
resourceLoaderPaths
@Nullable private String[] resourceLoaderPaths
Resource loader paths.
-
-
Method Detail
-
init
public void init(org.apache.velocity.util.ExtProperties configuration)
- Specified by:
initin classorg.apache.velocity.runtime.resource.loader.ResourceLoader
-
getResourceReader
public Reader getResourceReader(String source, String encoding) throws org.apache.velocity.exception.ResourceNotFoundException
- Specified by:
getResourceReaderin 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
-
-