|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.InternalResourceView org.springframework.web.servlet.view.tiles.TilesView
public class TilesView
View implementation that retrieves a Tiles definition. The "url" property is interpreted as name of a Tiles definition.
TilesJstlView with JSTL support is a separate class, mainly to avoid JSTL dependencies in this class.
Depends on a Tiles DefinitionsFactory which must be available in the ServletContext. This factory is typically set up via a TilesConfigurer bean definition in the application context.
A component controller specified in the Tiles definition will receive a reference to the current Spring ApplicationContext if it implements ApplicationContextAware. The ComponentControllerSupport class provides a convenient base class for such Spring-aware component controllers.
AbstractUrlBasedView.setUrl(java.lang.String)
,
TilesJstlView
,
TilesConfigurer
,
ComponentControllerSupport
,
ApplicationContextAware
Field Summary | |
---|---|
static String |
PATH_ATTRIBUTE
Name of the attribute that will override the path of the layout page to render. |
Fields inherited from class org.springframework.web.servlet.view.AbstractView |
---|
DEFAULT_CONTENT_TYPE |
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
logger |
Constructor Summary | |
---|---|
TilesView()
|
Method Summary | |
---|---|
protected void |
executeController(Controller controller,
ComponentContext context,
HttpServletRequest request,
HttpServletResponse response)
Execute the given Tiles controller. |
protected ComponentContext |
getComponentContext(ComponentDefinition definition,
HttpServletRequest request)
Determine the Tiles component context for the given Tiles definition. |
protected ComponentDefinition |
getComponentDefinition(DefinitionsFactory factory,
HttpServletRequest request)
Determine the Tiles component definition for the given Tiles definitions factory. |
protected Controller |
getController(ComponentDefinition definition,
HttpServletRequest request)
Determine and initialize the Tiles component controller for the given Tiles definition, if any. |
protected String |
getDispatcherPath(ComponentDefinition definition,
HttpServletRequest request)
Determine the dispatcher path for the given Tiles definition, i.e. the request dispatcher path of the layout page. |
protected void |
initApplicationContext()
Subclasses can override this for custom initialization behavior. |
protected String |
prepareForRendering(HttpServletRequest request,
HttpServletResponse response)
Prepare for rendering the Tiles definition: Execute the associated component controller if any, and determine the request dispatcher path. |
static void |
setPath(HttpServletRequest request,
String path)
Set the path of the layout page to render. |
Methods inherited from class org.springframework.web.servlet.view.InternalResourceView |
---|
exposeHelpers, exposeModelAsRequestAttributes, renderMergedOutputModel, useInclude |
Methods inherited from class org.springframework.web.servlet.view.AbstractUrlBasedView |
---|
afterPropertiesSet, getUrl, setUrl, toString |
Methods inherited from class org.springframework.web.servlet.view.AbstractView |
---|
addStaticAttribute, createRequestContext, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setRequestContextAttribute |
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
---|
getServletContext, getTempDir, getWebApplicationContext, isContextRequired |
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String PATH_ATTRIBUTE
setPath(javax.servlet.http.HttpServletRequest, java.lang.String)
Constructor Detail |
---|
public TilesView()
Method Detail |
---|
public static void setPath(HttpServletRequest request, String path)
request
- current HTTP requestpath
- the path of the layout pagePATH_ATTRIBUTE
protected void initApplicationContext() throws ApplicationContextException
ApplicationObjectSupport
setApplicationContext
after setting the context instance.
Note: Does not get called on reinitialization of the context but rather just on first initialization of this object's context reference.
initApplicationContext
in class ApplicationObjectSupport
ApplicationContextException
- in case of initialization errorsApplicationObjectSupport.setApplicationContext(org.springframework.context.ApplicationContext)
protected String prepareForRendering(HttpServletRequest request, HttpServletResponse response) throws Exception
prepareForRendering
in class InternalResourceView
request
- current HTTP requestresponse
- current HTTP response
Exception
- if preparations failedAbstractUrlBasedView.getUrl()
,
prepareForRendering(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
protected ComponentDefinition getComponentDefinition(DefinitionsFactory factory, HttpServletRequest request) throws Exception
factory
- the Tiles definitions factoryrequest
- current HTTP request
Exception
protected ComponentContext getComponentContext(ComponentDefinition definition, HttpServletRequest request) throws Exception
definition
- the Tiles definition to renderrequest
- current HTTP request
Exception
- if preparations failedprotected Controller getController(ComponentDefinition definition, HttpServletRequest request) throws Exception
definition
- the Tiles definition to renderrequest
- current HTTP request
null
if none
Exception
- if preparations failedprotected void executeController(Controller controller, ComponentContext context, HttpServletRequest request, HttpServletResponse response) throws Exception
controller
- the component controller to executecontext
- the component contextrequest
- current HTTP requestresponse
- current HTTP response
Exception
- if controller execution failedprotected String getDispatcherPath(ComponentDefinition definition, HttpServletRequest request) throws Exception
definition
- the Tiles definition to renderrequest
- current HTTP request
Exception
- if preparations failed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |