Package org.craftercms.engine.freemarker
Class ExecuteControllerDirective
java.lang.Object
org.craftercms.engine.freemarker.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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Field Summary
FieldsFields inherited from interface freemarker.template.TemplateModel
NOTHING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateScriptVariables(freemarker.core.Environment env) voidexecute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body) protected voidexecuteController(String path, freemarker.core.Environment env) protected voidexecuteController(Script script, Map<String, Object> variables, freemarker.core.Environment env) protected SiteItemgetContentModel(freemarker.core.Environment env) protected StringgetPath(freemarker.template.TemplateModel pathParam, freemarker.core.Environment env) protected ObjectgetTemplateModel(freemarker.core.Environment env)
-
Field Details
-
PATH_PARAM_NAME
- See Also:
-
servletContext
protected jakarta.servlet.ServletContext servletContext
-
-
Constructor Details
-
ExecuteControllerDirective
public ExecuteControllerDirective(jakarta.servlet.ServletContext servletContext)
-
-
Method Details
-
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:
executein interfacefreemarker.template.TemplateDirectiveModel- Throws:
freemarker.template.TemplateExceptionIOException
-
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
-