public class TilesView extends AbstractUrlBasedView
View
implementation that renders
through the Tiles Request API. The "url" property is interpreted as name of a
Tiles definition.DEFAULT_CONTENT_TYPE
logger
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
Constructor and Description |
---|
TilesView() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
boolean |
checkResource(Locale locale)
Check whether the underlying resource that the configured URL points to
actually exists.
|
protected Request |
createTilesRequest(HttpServletRequest request,
HttpServletResponse response)
Create a Tiles
Request . |
protected void |
renderMergedOutputModel(Map<String,Object> model,
HttpServletRequest request,
HttpServletResponse response)
Subclasses must implement this method to actually render the view.
|
void |
setAlwaysInclude(boolean alwaysInclude)
Specify whether to always include the view rather than forward to it.
|
protected void |
setExposeJstlAttributes(boolean exposeJstlAttributes)
Whether to expose JSTL attributes.
|
void |
setRenderer(Renderer renderer)
Set the
Renderer to use. |
getUrl, isUrlRequired, setUrl, toString
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
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
public void setRenderer(Renderer renderer)
Renderer
to use.
If not set, by default DefinitionRenderer
is used.protected void setExposeJstlAttributes(boolean exposeJstlAttributes)
true
.public void setAlwaysInclude(boolean alwaysInclude)
Default is "false". Switch this flag on to enforce the use of a Servlet include, even if a forward would be possible.
TilesViewResolver.setAlwaysInclude(java.lang.Boolean)
public void afterPropertiesSet() throws Exception
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class AbstractUrlBasedView
Exception
- in the event of misconfiguration (such
as failure to set an essential property) or if initialization fails.public boolean checkResource(Locale locale) throws Exception
AbstractUrlBasedView
checkResource
in class AbstractUrlBasedView
locale
- 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 renderMergedOutputModel(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception
AbstractView
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.
renderMergedOutputModel
in class AbstractView
model
- combined output Map (never null
),
with dynamic values taking precedence over static attributesrequest
- current HTTP requestresponse
- current HTTP responseException
- if rendering failedprotected Request createTilesRequest(HttpServletRequest request, HttpServletResponse response)
Request
.
This implementation creates a ServletRequest
.
request
- the current requestresponse
- the current response