Class ExecuteControllerDirective

  • All Implemented Interfaces:
    freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel

    public class ExecuteControllerDirective
    extends Object
    implements freemarker.template.TemplateDirectiveModel
    Freemarker directive that allows to execute scripts/controllers from inside Freemarker templates. The directive receives a single parameter that is that path of the controller in the site.
    Author:
    avasquez
    • Field Detail

      • servletContext

        protected javax.servlet.ServletContext servletContext
    • Constructor Detail

      • ExecuteControllerDirective

        public ExecuteControllerDirective()
    • Method Detail

      • setServletContext

        public void setServletContext​(javax.servlet.ServletContext servletContext)
      • execute

        public void execute​(freemarker.core.Environment env,
                            Map params,
                            freemarker.template.TemplateModel[] loopVars,
                            freemarker.template.TemplateDirectiveBody body)
                     throws freemarker.template.TemplateException,
                            IOException
        Specified by:
        execute in interface freemarker.template.TemplateDirectiveModel
        Throws:
        freemarker.template.TemplateException
        IOException
      • executeController

        protected void executeController​(String path,
                                         freemarker.core.Environment env)
                                  throws freemarker.template.TemplateException
        Throws:
        freemarker.template.TemplateException
      • executeController

        protected void executeController​(Script script,
                                         Map<String,​Object> variables,
                                         freemarker.core.Environment env)
                                  throws freemarker.template.TemplateException
        Throws:
        freemarker.template.TemplateException
      • createScriptVariables

        protected Map<String,​Object> createScriptVariables​(freemarker.core.Environment env)
                                                          throws freemarker.template.TemplateException
        Throws:
        freemarker.template.TemplateException
      • getPath

        protected String getPath​(freemarker.template.TemplateModel pathParam,
                                 freemarker.core.Environment env)
                          throws freemarker.template.TemplateException
        Throws:
        freemarker.template.TemplateException
      • getContentModel

        protected SiteItem getContentModel​(freemarker.core.Environment env)
                                    throws freemarker.template.TemplateException
        Throws:
        freemarker.template.TemplateException
      • getTemplateModel

        protected Object getTemplateModel​(freemarker.core.Environment env)
                                   throws freemarker.template.TemplateException
        Throws:
        freemarker.template.TemplateException