public abstract class AbstractFreeMarkerRenderer extends AbstractResponseRenderer
| Constructor and Description |
|---|
AbstractFreeMarkerRenderer() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
afterRender(RequestContext context)
Invoked after render.
|
protected abstract void |
beforeRender(RequestContext context)
Invoked before render.
|
protected void |
doRender(String html,
Request request,
Response response)
Processes the specified FreeMarker template with the specified request, data model and response.
|
protected String |
genHTML(Request request,
Map<String,Object> dataModel,
freemarker.template.Template template)
Processes the specified FreeMarker template with the specified request, data model.
|
Map<String,Object> |
getDataModel()
Gets the data model.
|
Map<String,Object> |
getRenderDataModel()
Gets the data model.
|
protected abstract freemarker.template.Template |
getTemplate()
Gets a template.
|
String |
getTemplateName()
Gets the template name.
|
void |
render(RequestContext context)
Renders with the specified HTTP request context.
|
void |
setTemplateName(String templateName)
Sets the template name with the specified template name.
|
postRender, preRender, setRendererIdprotected abstract void beforeRender(RequestContext context) throws Exception
context - the specified contextException - exceptionprotected abstract void afterRender(RequestContext context) throws Exception
context - the specified contextException - exceptionprotected abstract freemarker.template.Template getTemplate()
null if not foundpublic void render(RequestContext context)
ResponseRendererrender in interface ResponseRendererrender in class AbstractResponseRenderercontext - the specified HTTP request contextprotected String genHTML(Request request, Map<String,Object> dataModel, freemarker.template.Template template) throws Exception
request - the specified requestdataModel - the specified data modeltemplate - the specified FreeMarker templateException - exceptionprotected void doRender(String html, Request request, Response response)
Puts the page response contents into cache with the key getting from request attribute specified by page cache key.
html - the specified HTML contentrequest - the specified requestresponse - the specified responsepublic String getTemplateName()
public void setTemplateName(String templateName)
templateName - the specified template namepublic Map<String,Object> getRenderDataModel()
AbstractResponseRenderergetRenderDataModel in class AbstractResponseRendererCopyright © 2009–2019 B3log. All rights reserved.