public abstract class FreeMarkerTag extends Object implements freemarker.template.TemplateDirectiveModel, RequestAccess
LOGGER
Constructor and Description |
---|
FreeMarkerTag() |
Modifier and Type | Method and Description |
---|---|
void |
execute(freemarker.core.Environment env,
Map params,
freemarker.template.TemplateModel[] loopVars,
freemarker.template.TemplateDirectiveBody body) |
protected freemarker.template.TemplateModel |
get(Object name)
Gets an object from context - by name.
|
protected Map |
getAllVariables()
Returns a map of all variables in scope.
|
protected String |
getContextPath()
Returns this applications' context path.
|
protected Object |
getUnwrapped(Object name)
Gets an object from context - by name.
|
protected <T> T |
getUnwrapped(Object name,
Class<T> clazz) |
protected org.slf4j.Logger |
logger()
Provides a logger to a subclass.
|
void |
overrideContext(String context)
Use to override context of the application.
|
protected void |
process(String text,
Map params,
Writer writer)
Processes text as a FreeMarker template.
|
protected abstract void |
render(Map params,
String body,
Writer writer)
Implement this method ina concrete subclass.
|
protected Map |
session()
Returns reference to a current session map.
|
protected Object |
sessionObject(String name)
Convenience method, returns object from session, equivalent of:
|
protected void |
validateParamsPresence(Map params,
String... names)
Will throw
IllegalArgumentException if a parameter on the list is missing |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appContext, context, cookie, cookies, cookieValue, exists, format, getId, getLocale, getRequestHost, getRequestPort, getRequestProperties, getRequestProtocol, getRoute, header, headers, host, ipAddress, ipForwardedFor, isDelete, isGet, isHead, isMethod, isMultipartContent, isPost, isPut, isXhr, locale, method, param, param, params, params, params, params1st, params1st, path, port, protocol, queryString, remoteAddress, remoteHost, requestHas, servletPath, session, session, uri, url, userAgent, xhr
protected org.slf4j.Logger logger()
public void execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body) throws freemarker.template.TemplateException, IOException
execute
in interface freemarker.template.TemplateDirectiveModel
freemarker.template.TemplateException
IOException
protected freemarker.template.TemplateModel get(Object name)
name
- name of objectprotected Object getUnwrapped(Object name)
name
- name of objectprotected abstract void render(Map params, String body, Writer writer) throws Exception
params
- this is a list of parameters as provided to tag in HTML.body
- body of tagwriter
- writer to write output to.Exception
- if anyprotected void validateParamsPresence(Map params, String... names)
IllegalArgumentException
if a parameter on the list is missingparams
- as a map passed in by Freemarkernames
- list if valid parameter names for this tag.protected String getContextPath()
protected void process(String text, Map params, Writer writer)
text
- text of a template.params
- map with parameters for processing.writer
- writer to write output to.protected Map getAllVariables()
public void overrideContext(String context)
context
- this context will be used instead of one provided by Servlet APIprotected Map session()
Copyright © 2020 JavaLite. All rights reserved.