public class GroovyMarkupView extends AbstractTemplateView
AbstractTemplateView
based on Groovy XML/XHTML markup templates.
Spring's Groovy Markup Template support requires Groovy 2.3.1 and higher.
GroovyMarkupViewResolver,
GroovyMarkupConfigurer,
Groovy Markup Template engine documentationSPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTEDEFAULT_CONTENT_TYPEloggerPATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE| Constructor and Description |
|---|
GroovyMarkupView() |
| Modifier and Type | Method and Description |
|---|---|
protected groovy.text.markup.MarkupTemplateEngine |
autodetectMarkupTemplateEngine()
Autodetect a MarkupTemplateEngine via the ApplicationContext.
|
boolean |
checkResource(Locale locale)
Check whether the underlying resource that the configured URL points to
actually exists.
|
protected groovy.text.Template |
getTemplate(String viewUrl)
Return a template compiled by the configured Groovy Markup template engine
for the given view URL.
|
protected void |
initApplicationContext(ApplicationContext context)
Invoked at startup.
|
protected void |
renderMergedTemplateModel(Map<String,Object> model,
HttpServletRequest request,
HttpServletResponse response)
Subclasses must implement this method to actually render the view.
|
void |
setTemplateEngine(groovy.text.markup.MarkupTemplateEngine engine)
Set the MarkupTemplateEngine to use in this view.
|
applyContentType, renderMergedOutputModel, setAllowRequestOverride, setAllowSessionOverride, setExposeRequestAttributes, setExposeSessionAttributes, setExposeSpringMacroHelpersafterPropertiesSet, getUrl, isUrlRequired, setUrl, toStringaddStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponsegetServletContext, getTempDir, getWebApplicationContext, initServletContext, isContextRequired, setServletContextgetApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContextpublic void setTemplateEngine(groovy.text.markup.MarkupTemplateEngine engine)
If not set, the engine is auto-detected by looking up up a single
GroovyMarkupConfig bean in the web application context and using
it to obtain the configured MarkupTemplateEngine instance.
GroovyMarkupConfigpublic boolean checkResource(Locale locale) throws Exception
AbstractUrlBasedViewcheckResource in class AbstractUrlBasedViewlocale - the desired Locale that we're looking fortrue if the resource exists (or is assumed to exist);
false if we know that it does not existException - if the resource exists but is invalid (e.g. could not be parsed)protected void initApplicationContext(ApplicationContext context)
templateEngine has
been manually set, this method looks up a GroovyMarkupConfig bean
by type and uses it to obtain the Groovy Markup template engine.initApplicationContext in class WebApplicationObjectSupportcontext - the containing ApplicationContextGroovyMarkupConfig,
setTemplateEngine(groovy.text.markup.MarkupTemplateEngine)protected groovy.text.markup.MarkupTemplateEngine autodetectMarkupTemplateEngine()
throws BeansException
BeansExceptionprotected void renderMergedTemplateModel(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception
AbstractTemplateViewrenderMergedTemplateModel in class AbstractTemplateViewmodel - combined output Map, with request attributes and
session attributes merged into it if requiredrequest - current HTTP requestresponse - current HTTP responseException - if rendering failed