Class TilesView
- All Implemented Interfaces:
Aware,BeanNameAware,InitializingBean,ApplicationContextAware,ServletContextAware,View
public class TilesView extends AbstractUrlBasedView
Viewimplementation that renders through the Tiles Request API. The "url" property is interpreted as name of a Tiles definition.- Since:
- 3.2
- Author:
- Nicolas Le Bas, mick semb wever, Rossen Stoyanchev, Sebastien Deleuze
Field Summary
Fields inherited from class org.springframework.web.servlet.view.AbstractView
DEFAULT_CONTENT_TYPE
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
Fields inherited from interface org.springframework.web.servlet.View
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
Constructor Summary
Constructors Constructor Description TilesView()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()Invoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.booleancheckResource(Locale locale)Check whether the underlying resource that the configured URL points to actually exists.protected RequestcreateTilesRequest(HttpServletRequest request, HttpServletResponse response)Create a TilesRequest.protected voidrenderMergedOutputModel(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response)Subclasses must implement this method to actually render the view.voidsetAlwaysInclude(boolean alwaysInclude)Specify whether to always include the view rather than forward to it.protected voidsetExposeJstlAttributes(boolean exposeJstlAttributes)Whether to expose JSTL attributes.voidsetRenderer(Renderer renderer)Set theRendererto use.Methods inherited from class org.springframework.web.servlet.view.AbstractUrlBasedView
getUrl, isUrlRequired, setUrl, toString
Methods inherited from class org.springframework.web.servlet.view.AbstractView
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponse
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
Constructor Detail
TilesView
public TilesView()
Method Detail
setRenderer
public void setRenderer(Renderer renderer)
Set theRendererto use. If not set, by defaultDefinitionRendereris used.
setExposeJstlAttributes
protected void setExposeJstlAttributes(boolean exposeJstlAttributes)
Whether to expose JSTL attributes. By default set totrue.
setAlwaysInclude
public void setAlwaysInclude(boolean alwaysInclude)
Specify whether to always include the view rather than forward to it.Default is "false". Switch this flag on to enforce the use of a Servlet include, even if a forward would be possible.
- Since:
- 4.1.2
- See Also:
TilesViewResolver.setAlwaysInclude(java.lang.Boolean)
afterPropertiesSet
public void afterPropertiesSet() throws Exception
Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classAbstractUrlBasedView- Throws:
Exception- in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
checkResource
public boolean checkResource(Locale locale) throws Exception
Description copied from class:AbstractUrlBasedViewCheck whether the underlying resource that the configured URL points to actually exists.- Overrides:
checkResourcein classAbstractUrlBasedView- 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)
renderMergedOutputModel
protected void renderMergedOutputModel(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception
Description copied from class:AbstractViewSubclasses must implement this method to actually render the view.The first step will be preparing the request: In the JSP case, this would mean setting model objects as request attributes. The second step will be the actual rendering of the view, for example including the JSP via a RequestDispatcher.
- Specified by:
renderMergedOutputModelin classAbstractView- Parameters:
model- combined output Map (nevernull), with dynamic values taking precedence over static attributesrequest- current HTTP requestresponse- current HTTP response- Throws:
Exception- if rendering failed
createTilesRequest
protected Request createTilesRequest(HttpServletRequest request, HttpServletResponse response)
Create a TilesRequest.This implementation creates a
ServletRequest.- Parameters:
request- the current requestresponse- the current response- Returns:
- the Tiles request