Class CustomResourceLoader
java.lang.Object
org.apache.velocity.runtime.resource.loader.ResourceLoader
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
com.atlassian.confluence.setup.velocity.CustomResourceLoader
public class CustomResourceLoader
extends org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
CustomResourceLoader extends the ClasspathResourceLoader to provide custom resource loading functionality.
It checks for allowed file types and protocols before loading a resource.
It is basically used for running unit and integration tests within confluence.
-
Field Summary
Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
className, isCachingOn, log, modificationCheckInterval, rsvc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetResourceStream
(String name) Returns an InputStream for the resource with the given name.void
init
(org.apache.commons.collections.ExtendedProperties extendedProperties) Initializes the CustomResourceLoader with the provided properties.Methods inherited from class org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
getLastModified, isSourceModified
Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval
-
Constructor Details
-
CustomResourceLoader
public CustomResourceLoader()
-
-
Method Details
-
init
public void init(org.apache.commons.collections.ExtendedProperties extendedProperties) Initializes the CustomResourceLoader with the provided properties. It sets up the file and file type allowlist helpers and the list of trusted resource protocols.- Overrides:
init
in classorg.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
- Parameters:
extendedProperties
- The properties to initialize the resource loader with.
-
getResourceStream
public InputStream getResourceStream(String name) throws org.apache.velocity.exception.ResourceNotFoundException Returns an InputStream for the resource with the given name. It checks if the resource's file type and protocol are allowed before loading it.- Overrides:
getResourceStream
in classorg.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
- Parameters:
name
- The name of the resource to load.- Returns:
- An InputStream for the resource.
- Throws:
org.apache.velocity.exception.ResourceNotFoundException
- If the resource is not found or its file type or file is not allowed.
-