Class AtlassianClasspathResourceLoader

java.lang.Object
org.apache.velocity.runtime.resource.loader.ResourceLoader
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
com.atlassian.templaterenderer.velocity.resource.AtlassianClasspathResourceLoader

public class AtlassianClasspathResourceLoader extends org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
Based off ClasspathResourceLoader, all products should use this instead.

We needed to diverge from what's in the engine to allow for Atlassian-specific concerns.

If you make changes here, please try to put them into the engine

Since:
6.0.1
  • Field Summary

    Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader

    className, isCachingOn, log, modificationCheckInterval, rsvc
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    WARNING This should only ever fetch files from the context classloader and the classloader of this file.
    void
    init(org.apache.commons.collections.ExtendedProperties configuration)
     

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AtlassianClasspathResourceLoader

      public AtlassianClasspathResourceLoader()
  • Method Details

    • init

      public void init(org.apache.commons.collections.ExtendedProperties configuration)
      Overrides:
      init in class org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
    • getResourceStream

      public InputStream getResourceStream(String name) throws org.apache.velocity.exception.ResourceNotFoundException
      WARNING This should only ever fetch files from the context classloader and the classloader of this file. This is how we know that within ATR that it will only ever fetch files from the plugin using ATR. Not only is this great for our sanity (predictable and isolated plugin behaviour), but is also a security requirement to prevent circumventing the file and file type allowlist.
      Overrides:
      getResourceStream in class org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
      Throws:
      org.apache.velocity.exception.ResourceNotFoundException