Class AppTemplateService


  • public final class AppTemplateService
    extends java.lang.Object
    This Service is used to retreive HTML templates, stored as files in the WEB-INF/templates directory of the webapp, to build the user interface. It provides a cache feature to prevent from loading file each time it is asked.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate)
      Returns a reference on a template object (load the template or get it from the cache if present.)
      static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate, java.lang.String strPath)
      Returns a reference on a template object (load the template or get it from the cache if present.)
      static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate, java.lang.String strPath, java.util.Locale locale, java.lang.Object model)
      Returns a reference on a template object (load the template or get it from the cache if present.)
      static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate, java.util.Locale locale)
      Returns a reference on a template object (load the template or get it from the cache if present.)
      static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate, java.util.Locale locale, java.lang.Object model)
      Returns a reference on a template object (load the template or get it from the cache if present.)
      static fr.paris.lutece.util.html.HtmlTemplate getTemplateFromStringFtl​(java.lang.String strFreemarkerTemplateName, java.lang.String strFreemarkerTemplateData, java.util.Locale locale, java.lang.Object model, boolean bResetCache)
      Returns a reference on a template object using the template data passed in parameter or getting from cache if present
      static fr.paris.lutece.util.html.HtmlTemplate getTemplateFromStringFtl​(java.lang.String strFreemarkerTemplateData, java.util.Locale locale, java.lang.Object model)
      Returns a reference on a template object using the template data passed in parameter or getting from cache if present
      static void init​(java.lang.String strTemplatePath)
      Initializes the service with the templates's path
      static void initMacros()
      Initializes auto-includes and auto-imports for plugins.
      static void resetCache()
      Reset the cache
      static void resetConfiguration()
      Resets the configuration cache
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • init

        public static void init​(java.lang.String strTemplatePath)
        Initializes the service with the templates's path
        Parameters:
        strTemplatePath - The template path
      • initMacros

        public static void initMacros()
        Initializes auto-includes and auto-imports for plugins.
      • resetCache

        public static void resetCache()
        Reset the cache
      • resetConfiguration

        public static void resetConfiguration()
        Resets the configuration cache
      • getTemplate

        public static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate)
        Returns a reference on a template object (load the template or get it from the cache if present.)
        Parameters:
        strTemplate - The name of the template
        Returns:
        The template object.
      • getTemplate

        public static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate,
                                                                         java.lang.String strPath)
        Returns a reference on a template object (load the template or get it from the cache if present.)
        Parameters:
        strTemplate - The name of the template
        strPath - The specific path to load the template
        Returns:
        The template object.
        Since:
        1.3.1
      • getTemplate

        public static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate,
                                                                         java.util.Locale locale)
        Returns a reference on a template object (load the template or get it from the cache if present.)
        Parameters:
        strTemplate - The name of the template
        locale - The current locale to localize the template
        Returns:
        The template object.
        Since:
        1.5
      • getTemplate

        public static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate,
                                                                         java.util.Locale locale,
                                                                         java.lang.Object model)
        Returns a reference on a template object (load the template or get it from the cache if present.)
        Parameters:
        strTemplate - The name of the template
        locale - The current locale to localize the template
        model - the model to use for loading
        Returns:
        The template object.
        Since:
        1.5
      • getTemplate

        public static fr.paris.lutece.util.html.HtmlTemplate getTemplate​(java.lang.String strTemplate,
                                                                         java.lang.String strPath,
                                                                         java.util.Locale locale,
                                                                         java.lang.Object model)
        Returns a reference on a template object (load the template or get it from the cache if present.)
        Parameters:
        strTemplate - The name of the template
        strPath - The specific path to load the template
        locale - The current locale to localize the template
        model - the model to use for loading
        Returns:
        The template object.
        Since:
        1.5
      • getTemplateFromStringFtl

        public static fr.paris.lutece.util.html.HtmlTemplate getTemplateFromStringFtl​(java.lang.String strFreemarkerTemplateData,
                                                                                      java.util.Locale locale,
                                                                                      java.lang.Object model)
        Returns a reference on a template object using the template data passed in parameter or getting from cache if present
        Parameters:
        strFreemarkerTemplateData - The content of the template
        locale - The current Locale to localize the template
        model - The model
        Returns:
        The template object
        Since:
        1.5
      • getTemplateFromStringFtl

        public static fr.paris.lutece.util.html.HtmlTemplate getTemplateFromStringFtl​(java.lang.String strFreemarkerTemplateName,
                                                                                      java.lang.String strFreemarkerTemplateData,
                                                                                      java.util.Locale locale,
                                                                                      java.lang.Object model,
                                                                                      boolean bResetCache)
        Returns a reference on a template object using the template data passed in parameter or getting from cache if present
        Parameters:
        strFreemarkerTemplateName - The name of the template ( Must be a Fully qualified name for example skin.plugins.myplugin.manage_my_objects )
        strFreemarkerTemplateData - The content of the template
        locale - The current Locale to localize the template
        model - The model
        bResetCache - true if the template stored in cache must be updated by the content of the strFreemarkerTemplateDa
        Returns:
        The template object
        Since:
        7.0.5