
public.javadoc.org.spincast.plugins.templatingaddon.SpincastTemplatingRequestContextAddon.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
SpincastTemplatingRequestContextAddon (org.spincast:spincast-framework 2.1.1 API)
Class SpincastTemplatingRequestContextAddon<R extends RequestContext<?>>
java.lang.Object
org.spincast.plugins.templatingaddon.SpincastTemplatingRequestContextAddon<R>
- All Implemented Interfaces:
TemplatingRequestContextAddon<R>
public class SpincastTemplatingRequestContextAddon<R extends RequestContext<?>>
extends Object
implements TemplatingRequestContextAddon<R>
-
Constructor Summary
Constructors
Constructor
Description
SpincastTemplatingRequestContextAddon(R requestContext,
TemplatingEngine templatingEngine,
LocaleResolver localeResolver,
JsonManager jsonManager)
-
Method Summary
Modifier and Type
Method
Description
void
addTemplatingGlobalVariable(String key,
Object value)
Adds a global variable that will be available to any following
evaluation by the templating engine.
void
addTemplatingGlobalVariables(Map<String,Object> variables)
Adds global variables that will be available to any following
evaluation by the templating engine.
protected Object
Converts JsonObject and JsonArray to plain Maps and Lists.
createPlaceholder(String variable)
Creates a placeholder using the current templating engine
implementation.
void
Deletes all global templating variables.
void
Deletes a global templating variable.
Evaluates some content without any parameters.
Evaluates some content using the given parameters.
Evaluates some content using the given parameters.
evaluate(String content,
JsonObject model)
Evaluates some content using the given parameters.
evaluate(String content,
JsonObject model,
Locale locale)
Evaluates some content using the given parameters.
fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params)
Renders a template using the given parameters.
fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params,
Locale locale)
Renders a template usgin the given parameters.
fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject model)
Renders a template using the given parameters.
fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject model,
Locale locale)
Renders a template usgin the given parameters.
fromTemplate(String templatePath,
Map<String,Object> params)
Renders a template using the given parameters.
Renders a template usgin the given parameters.
fromTemplate(String templatePath,
JsonObject model)
Renders a template using the given parameters.
fromTemplate(String templatePath,
JsonObject model,
Locale locale)
Renders a template usgin the given parameters.
protected JsonManager
protected LocaleResolver
protected Locale
protected R
Gets the Map reserved for Spincast usage to put some
global templating variables.
protected TemplatingEngine
Gets a global templating variable.
The global templating variables.
-
Constructor Details
-
SpincastTemplatingRequestContextAddon
@Inject
public SpincastTemplatingRequestContextAddon(R requestContext,
TemplatingEngine templatingEngine,
LocaleResolver localeResolver,
JsonManager jsonManager)
-
Method Details
-
getRequestContext
-
getTemplatingEngine
-
getLocaleResolver
-
getJsonManager
-
getLocaleToUse
-
getTemplatingGlobalVariables
Description copied from interface: TemplatingRequestContextAddon
The global templating variables.
- Specified by:
getTemplatingGlobalVariables
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
evaluate
Description copied from interface: TemplatingRequestContextAddon
Evaluates some content using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Specified by:
evaluate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
evaluate
Description copied from interface: TemplatingRequestContextAddon
Evaluates some content using the given parameters.
Uses the specified Locale
.
- Specified by:
evaluate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
evaluate
Description copied from interface: TemplatingRequestContextAddon
Evaluates some content without any parameters.
Uses the Locale
found by the LocaleResolver
.
- Specified by:
evaluate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
evaluate
Description copied from interface: TemplatingRequestContextAddon
Evaluates some content using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Specified by:
evaluate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
evaluate
Description copied from interface: TemplatingRequestContextAddon
Evaluates some content using the given parameters.
Uses the specified Locale
.
- Specified by:
evaluate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
fromTemplate
Description copied from interface: TemplatingRequestContextAddon
Renders a template using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Specified by:
fromTemplate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
Description copied from interface: TemplatingRequestContextAddon
Renders a template usgin the given parameters.
Uses the Locale
specified.
- Specified by:
fromTemplate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
Description copied from interface: TemplatingRequestContextAddon
Renders a template using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Specified by:
fromTemplate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
isClasspathPath
- if true
, the 'templatePath' is considered as
a classpath's relative path. If false
, it is considered as an absolute file
system path.
-
fromTemplate
Description copied from interface: TemplatingRequestContextAddon
Renders a template using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Specified by:
fromTemplate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
Description copied from interface: TemplatingRequestContextAddon
Renders a template using the given parameters.
Uses the Locale
found by the LocaleResolver
.
- Specified by:
fromTemplate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
isClasspathPath
- if true
, the 'templatePath' is considered as
a classpath's relative path. If false
, it is considered as an absolute file
system path.
-
fromTemplate
Description copied from interface: TemplatingRequestContextAddon
Renders a template usgin the given parameters.
Uses the Locale
specified.
- Specified by:
fromTemplate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
- Parameters:
templatePath
- must be a classpath's relative path.
-
fromTemplate
public String fromTemplate(String templatePath,
boolean isClasspathPath,
JsonObject model,
Locale locale)
Description copied from interface: TemplatingRequestContextAddon
Renders a template usgin the given parameters.
Uses the Locale
specified.
- Specified by:
fromTemplate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
isClasspathPath
- if true
, the 'templatePath' is considered as
a classpath's relative path. If false
, it is considered as an absolute file
system path.
-
fromTemplate
public String fromTemplate(String templatePath,
boolean isClasspathPath,
Map<String,Object> params,
Locale locale)
Description copied from interface: TemplatingRequestContextAddon
Renders a template usgin the given parameters.
Uses the Locale
specified.
- Specified by:
fromTemplate
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
isClasspathPath
- if true
, the 'templatePath' is considered as
a classpath's relative path. If false
, it is considered as an absolute file
system path.
-
addTemplatingGlobalVariable
Description copied from interface: TemplatingRequestContextAddon
Adds a global variable that will be available to any following
evaluation by the templating engine.
- Specified by:
addTemplatingGlobalVariable
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
convertTemplatingGlobalVariableValue
Converts JsonObject and JsonArray to plain Maps and Lists.
-
addTemplatingGlobalVariables
Description copied from interface: TemplatingRequestContextAddon
Adds global variables that will be available to any following
evaluation by the templating engine.
- Specified by:
addTemplatingGlobalVariables
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
getTemplatingGlobalVariable
Description copied from interface: TemplatingRequestContextAddon
Gets a global templating variable.
- Specified by:
getTemplatingGlobalVariable
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
deleteAllTemplatingGlobalVariables
public void deleteAllTemplatingGlobalVariables()
Description copied from interface: TemplatingRequestContextAddon
Deletes all global templating variables.
- Specified by:
deleteAllTemplatingGlobalVariables
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
deleteTemplatingGlobalVariable
Description copied from interface: TemplatingRequestContextAddon
Deletes a global templating variable.
- Specified by:
deleteTemplatingGlobalVariable
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
createPlaceholder
Description copied from interface: TemplatingRequestContextAddon
Creates a placeholder using the current templating engine
implementation.
This is mainly useful for the tests, which don't know in advance
which templating engine will be used, so which syntax to use
for the placeholders.
For example, using Pebble, a call to createPlaceholder("name")
will
result in "{{name}}
" (without the quotes).
- Specified by:
createPlaceholder
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
-
getSpincastReservedMap
Description copied from interface: TemplatingRequestContextAddon
Gets the Map reserved for Spincast usage to put some
global templating variables.
- Specified by:
getSpincastReservedMap
in interface TemplatingRequestContextAddon<R extends RequestContext<?>>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy