@Singleton public class TemplateEngineFreemarker extends Object implements TemplateEngine
| Modifier and Type | Field and Description |
|---|---|
static String |
FREEMARKER_CONFIGURATION_FILE_SUFFIX |
| Constructor and Description |
|---|
TemplateEngineFreemarker(Messages messages,
Lang lang,
org.slf4j.Logger logger,
TemplateEngineHelper templateEngineHelper,
TemplateEngineManager templateEngineManager,
TemplateEngineFreemarkerReverseRouteMethod templateEngineFreemarkerReverseRouteMethod,
TemplateEngineFreemarkerAssetsAtMethod templateEngineFreemarkerAssetsAtMethod,
TemplateEngineFreemarkerWebJarsAtMethod templateEngineFreemarkerWebJarsAtMethod,
NinjaProperties ninjaProperties) |
| Modifier and Type | Method and Description |
|---|---|
freemarker.template.Configuration |
getConfiguration()
Allows to modify the FreeMarker configuration.
|
String |
getContentType()
Get the content type this template engine renders
|
String |
getSuffixOfTemplatingEngine()
For instance returns ".ftl.html" Or .ftl.json.
|
void |
invoke(Context context,
Result result)
Render the given object to the given context
|
void |
throwRenderingException(Context context,
Result result,
Exception cause,
String knownTemplateSourcePath) |
public static final String FREEMARKER_CONFIGURATION_FILE_SUFFIX
@Inject public TemplateEngineFreemarker(Messages messages, Lang lang, org.slf4j.Logger logger, TemplateEngineHelper templateEngineHelper, TemplateEngineManager templateEngineManager, TemplateEngineFreemarkerReverseRouteMethod templateEngineFreemarkerReverseRouteMethod, TemplateEngineFreemarkerAssetsAtMethod templateEngineFreemarkerAssetsAtMethod, TemplateEngineFreemarkerWebJarsAtMethod templateEngineFreemarkerWebJarsAtMethod, NinjaProperties ninjaProperties) throws Exception
Exceptionpublic void invoke(Context context, Result result)
TemplateEngineinvoke in interface TemplateEnginecontext - The context to render toresult - The result to renderpublic void throwRenderingException(Context context, Result result, Exception cause, String knownTemplateSourcePath)
public String getContentType()
TemplateEnginegetContentType in interface TemplateEnginepublic String getSuffixOfTemplatingEngine()
TemplateEngineOr anything else. To display error messages in a nice way...
But Gson for instance does not use a template to render stuff. Therefore it will return null
getSuffixOfTemplatingEngine in interface TemplateEnginepublic freemarker.template.Configuration getConfiguration()
Copyright © 2019 ninjaframework. All rights reserved.