Class FreemarkerTemplateLoader

  • All Implemented Interfaces:
    freemarker.cache.TemplateLoader

    public class FreemarkerTemplateLoader
    extends freemarker.cache.URLTemplateLoader
    Special template loader for freemarker, required to support custom assets class loaders. It is not required if custom class loaders not used!

    The problem is that dropwizard views mechanism accepts only template path from classpath so if template provided by a custom class loader, default mechanism would try to load it with application class loader. This loader would take template name (already prepared to be absolute classpath path) and search it through all registered class loaders (based on classpath prefixes).

    Loader installed with main builder configuration ServerPagesBundle.ViewsBuilder.enableFreemarkerCustomClassLoadersSupport() shortcut (applied globally).

    Since:
    12.04.2020
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.net.URL getURL​(java.lang.String name)  
      • Methods inherited from class freemarker.cache.URLTemplateLoader

        canonicalizePrefix, closeTemplateSource, findTemplateSource, getLastModified, getReader, getURLConnectionUsesCaches, setURLConnectionUsesCaches
      • Methods inherited from class java.lang.Object

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

      • FreemarkerTemplateLoader

        public FreemarkerTemplateLoader()
    • Method Detail

      • getURL

        protected java.net.URL getURL​(java.lang.String name)
        Specified by:
        getURL in class freemarker.cache.URLTemplateLoader