类 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
public class GroovyMarkupView extends AbstractTemplateView
AnAbstractTemplateView
subclass based on Groovy XML/XHTML markup templates.Spring's Groovy Markup Template support requires Groovy 2.3.1 and higher.
- 从以下版本开始:
- 4.1
- 作者:
- Brian Clozel, Rossen Stoyanchev
- 另请参阅:
GroovyMarkupViewResolver
,GroovyMarkupConfigurer
, Groovy Markup Template engine documentation
字段概要
从类继承的字段 org.springframework.web.servlet.view.AbstractTemplateView
SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE
从类继承的字段 org.springframework.web.servlet.view.AbstractView
DEFAULT_CONTENT_TYPE
从类继承的字段 org.springframework.context.support.ApplicationObjectSupport
logger
从接口继承的字段 org.springframework.web.servlet.View
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
构造器概要
构造器 构造器 说明 GroovyMarkupView()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 org.springframework.web.servlet.view.AbstractTemplateView
applyContentType, renderMergedOutputModel, setAllowRequestOverride, setAllowSessionOverride, setExposeRequestAttributes, setExposeSessionAttributes, setExposeSpringMacroHelpers
从类继承的方法 org.springframework.web.servlet.view.AbstractUrlBasedView
afterPropertiesSet, getUrl, isUrlRequired, setUrl, toString
从类继承的方法 org.springframework.web.servlet.view.AbstractView
addStaticAttribute, 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, writeToResponse
从类继承的方法 org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initServletContext, isContextRequired, setServletContext
从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
构造器详细资料
GroovyMarkupView
public GroovyMarkupView()
方法详细资料
setTemplateEngine
public 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
GroovyMarkupConfig
bean in the web application context and using it to obtain the configuredMarkupTemplateEngine
instance.- 另请参阅:
GroovyMarkupConfig
initApplicationContext
protected void initApplicationContext(ApplicationContext context)
Invoked at startup. If notemplateEngine
has been manually set, this method looks up aGroovyMarkupConfig
bean by type and uses it to obtain the Groovy Markup template engine.- 覆盖:
initApplicationContext
在类中WebApplicationObjectSupport
- 参数:
context
- the containing ApplicationContext- 另请参阅:
GroovyMarkupConfig
,setTemplateEngine(groovy.text.markup.MarkupTemplateEngine)
autodetectMarkupTemplateEngine
protected groovy.text.markup.MarkupTemplateEngine autodetectMarkupTemplateEngine() throws BeansException
Autodetect a MarkupTemplateEngine via the ApplicationContext. Called if a MarkupTemplateEngine has not been manually configured.
checkResource
public boolean checkResource(Locale locale) throws Exception
从类复制的说明:AbstractUrlBasedView
Check whether the underlying resource that the configured URL points to actually exists.- 覆盖:
checkResource
在类中AbstractUrlBasedView
- 参数:
locale
- the desired Locale that we're looking for- 返回:
true
if the resource exists (or is assumed to exist);false
if we know that it does not exist- 抛出:
Exception
- if the resource exists but is invalid (e.g. could not be parsed)
renderMergedTemplateModel
protected void renderMergedTemplateModel(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception
从类复制的说明:AbstractTemplateView
Subclasses must implement this method to actually render the view.- 指定者:
renderMergedTemplateModel
在类中AbstractTemplateView
- 参数:
model
- combined output Map, with request attributes and session attributes merged into it if requiredrequest
- current HTTP requestresponse
- current HTTP response- 抛出:
Exception
- if rendering failed
getTemplate
protected groovy.text.Template getTemplate(String viewUrl) throws Exception
Return a template compiled by the configured Groovy Markup template engine for the given view URL.- 抛出:
Exception