Class ContextTemplateLoader

  • All Implemented Interfaces:
    freemarker.cache.TemplateLoader

    public class ContextTemplateLoader
    extends java.lang.Object
    implements freemarker.cache.TemplateLoader
    FreeMarker template loader based on a Context's client dispatcher. You can set an instance on a FreeMarker configuration via the Configuration.setTemplateLoader(TemplateLoader) method.
    Author:
    Jerome Louvel
    • Constructor Summary

      Constructors 
      Constructor Description
      ContextTemplateLoader​(org.restlet.Context context, java.lang.String baseUri)
      Constructor.
      ContextTemplateLoader​(org.restlet.Context context, org.restlet.data.Reference baseRef)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeTemplateSource​(java.lang.Object templateSource)
      Close the template source.
      java.lang.Object findTemplateSource​(java.lang.String name)
      Finds the object that acts as the source of the template with the given name.
      long getLastModified​(java.lang.Object templateSource)
      Returns the modification time.
      java.io.Reader getReader​(java.lang.Object templateSource, java.lang.String characterSet)
      Returns the reader for the template source.
      • Methods inherited from class java.lang.Object

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

      • ContextTemplateLoader

        public ContextTemplateLoader​(org.restlet.Context context,
                                     org.restlet.data.Reference baseRef)
        Constructor.
        Parameters:
        context - The Restlet context.
        baseRef - The base reference.
      • ContextTemplateLoader

        public ContextTemplateLoader​(org.restlet.Context context,
                                     java.lang.String baseUri)
        Constructor.
        Parameters:
        context - The Restlet context.
        baseUri - The base URI.
    • Method Detail

      • closeTemplateSource

        public void closeTemplateSource​(java.lang.Object templateSource)
                                 throws java.io.IOException
        Close the template source.
        Specified by:
        closeTemplateSource in interface freemarker.cache.TemplateLoader
        Parameters:
        templateSource - The template source Representation.
        Throws:
        java.io.IOException
      • findTemplateSource

        public java.lang.Object findTemplateSource​(java.lang.String name)
                                            throws java.io.IOException
        Finds the object that acts as the source of the template with the given name.
        Specified by:
        findTemplateSource in interface freemarker.cache.TemplateLoader
        Parameters:
        name - The template name.
        Returns:
        The template source Representation.
        Throws:
        java.io.IOException
      • getLastModified

        public long getLastModified​(java.lang.Object templateSource)
        Returns the modification time.
        Specified by:
        getLastModified in interface freemarker.cache.TemplateLoader
        Parameters:
        templateSource - The template source Representation.
        Returns:
        The modification time.
      • getReader

        public java.io.Reader getReader​(java.lang.Object templateSource,
                                        java.lang.String characterSet)
                                 throws java.io.IOException
        Returns the reader for the template source.
        Specified by:
        getReader in interface freemarker.cache.TemplateLoader
        Parameters:
        templateSource - The template source Representation.
        characterSet - The reader character set.
        Throws:
        java.io.IOException