Class GroovyMarkupView
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractView
org.springframework.web.servlet.view.AbstractUrlBasedView
org.springframework.web.servlet.view.AbstractTemplateView
org.springframework.web.servlet.view.groovy.GroovyMarkupView
- All Implemented Interfaces:
- Aware,- BeanNameAware,- InitializingBean,- ApplicationContextAware,- ServletContextAware,- View
An 
AbstractTemplateView subclass based on Groovy XML/XHTML markup templates.
 Spring's Groovy Markup Template support requires Groovy 2.3.1 and higher.
- Since:
- 4.1
- Author:
- Brian Clozel, Rossen Stoyanchev
- See Also:
- 
Field SummaryFields inherited from class org.springframework.web.servlet.view.AbstractTemplateViewSPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTEFields inherited from class org.springframework.web.servlet.view.AbstractViewDEFAULT_CONTENT_TYPEFields inherited from class org.springframework.context.support.ApplicationObjectSupportloggerFields inherited from interface org.springframework.web.servlet.ViewPATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected groovy.text.markup.MarkupTemplateEngineAutodetect a MarkupTemplateEngine via the ApplicationContext.booleancheckResource(Locale locale) Check whether the underlying resource that the configured URL points to actually exists.protected groovy.text.TemplategetTemplate(String viewUrl) Return a template compiled by the configured Groovy Markup template engine for the given view URL.protected voidinitApplicationContext(ApplicationContext context) Invoked at startup.protected voidrenderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) Subclasses must implement this method to actually render the view.voidsetTemplateEngine(groovy.text.markup.MarkupTemplateEngine engine) Set the MarkupTemplateEngine to use in this view.Methods inherited from class org.springframework.web.servlet.view.AbstractTemplateViewapplyContentType, renderMergedOutputModel, setAllowRequestOverride, setAllowSessionOverride, setExposeRequestAttributes, setExposeSessionAttributes, setExposeSpringMacroHelpersMethods inherited from class org.springframework.web.servlet.view.AbstractUrlBasedViewafterPropertiesSet, getUrl, isUrlRequired, setUrl, toStringMethods inherited from class org.springframework.web.servlet.view.AbstractViewaddStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, formatViewName, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponseMethods inherited from class org.springframework.web.context.support.WebApplicationObjectSupportgetServletContext, getTempDir, getWebApplicationContext, initServletContext, isContextRequired, setServletContextMethods inherited from class org.springframework.context.support.ApplicationObjectSupportgetApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
- 
Constructor Details- 
GroovyMarkupViewpublic GroovyMarkupView()
 
- 
- 
Method Details- 
setTemplateEnginepublic void setTemplateEngine(groovy.text.markup.MarkupTemplateEngine engine) Set the MarkupTemplateEngine to use in this view.If not set, the engine is auto-detected by looking up a single GroovyMarkupConfigbean in the web application context and using it to obtain the configuredMarkupTemplateEngineinstance.- See Also:
 
- 
initApplicationContextInvoked at startup. If notemplateEnginehas been manually set, this method looks up aGroovyMarkupConfigbean by type and uses it to obtain the Groovy Markup template engine.- Overrides:
- initApplicationContextin class- WebApplicationObjectSupport
- Parameters:
- context- the containing ApplicationContext
- See Also:
 
- 
autodetectMarkupTemplateEngineprotected groovy.text.markup.MarkupTemplateEngine autodetectMarkupTemplateEngine() throws BeansExceptionAutodetect a MarkupTemplateEngine via the ApplicationContext. Called if a MarkupTemplateEngine has not been manually configured.- Throws:
- BeansException
 
- 
checkResourceDescription copied from class:AbstractUrlBasedViewCheck whether the underlying resource that the configured URL points to actually exists.- Overrides:
- checkResourcein class- AbstractUrlBasedView
- Parameters:
- locale- the desired Locale that we're looking for
- Returns:
- trueif the resource exists (or is assumed to exist);- falseif we know that it does not exist
- Throws:
- Exception- if the resource exists but is invalid (e.g. could not be parsed)
 
- 
renderMergedTemplateModelprotected void renderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws ExceptionDescription copied from class:AbstractTemplateViewSubclasses must implement this method to actually render the view.- Specified by:
- renderMergedTemplateModelin class- AbstractTemplateView
- Parameters:
- model- combined output Map, with request attributes and session attributes merged into it if required
- request- current HTTP request
- response- current HTTP response
- Throws:
- Exception- if rendering failed
 
- 
getTemplateReturn a template compiled by the configured Groovy Markup template engine for the given view URL.- Throws:
- Exception
 
 
-