public abstract class AbstractWebFrameworkView
extends org.springframework.web.servlet.view.AbstractUrlBasedView
Abstract Spring MVC implementation of a view resolver for Surf.
Developers who wish to implement custom Spring views may wish to extend their own view implementations from this class so as to gain access to member convenience functions for working with Surf services.
| Modifier and Type | Field and Description |
|---|---|
static String |
MIMETYPE_HTML |
| Constructor and Description |
|---|
AbstractWebFrameworkView(WebFrameworkConfigElement webFrameworkConfiguration,
ModelObjectService modelObjectService,
ResourceService resourceService,
RenderService renderService,
TemplatesContainer templatesContainer)
Constructor
|
AbstractWebFrameworkView(WebFrameworkServiceRegistry webFrameworkServiceRegistry)
Deprecated.
Due to dependencies upon static helper methods rather than Spring configuration.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
exposeForwardRequestAttributes(javax.servlet.http.HttpServletRequest request)
Expose forward request attributes.
|
ModelObjectService |
getObjectService()
Gets a
ModelObjectService. |
RenderService |
getRenderService()
TODO: Add JavaDoc describing what a RenderService is!
|
ResourceService |
getResourceService()
Gets a
ResourceService. |
TemplatesContainer |
getTemplatesContainer()
TODO: Add JavaDoc describing what a TemplatesContainer is!
|
Map<String,String> |
getUriTokens()
Get the URI tokens for the view
|
URLHelperFactory |
getUrlHelperFactory() |
WebFrameworkConfigElement |
getWebFrameworkConfiguration()
Gets a
WebFrameworkConfigElement. |
protected Page |
lookupPage(String pageId)
Retrieves the page object with the given page id.
|
protected void |
populateRequestContext(RequestContext context,
javax.servlet.http.HttpServletRequest request)
Performs default population of the request context.
|
protected void |
renderMergedOutputModel(Map<String,Object> mvcModel,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This method must be implemented to actually render the view.
|
protected abstract void |
renderView(RequestContext context)
To be implemented by view classes to provide render dispatch
|
protected void |
setupRequestContext(Map<String,Object> mvcModel,
javax.servlet.http.HttpServletRequest request)
Implementation classes should extend this method to provide for any initial setup
of the request context.
|
void |
setUriTokens(Map<String,String> uriTokens)
Set the URI tokens associates with the view
|
void |
setUrlHelperFactory(URLHelperFactory urlHelper) |
protected void |
validateRequestContext(RequestContext context,
javax.servlet.http.HttpServletRequest request)
Extension point for performing any validation of the request context state
If the request context state is invalid, it can either be adjusted or an exception
can be raised.
|
afterPropertiesSet, checkResource, getUrl, isUrlRequired, setUrl, toStringaddStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponsegetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextpublic static final String MIMETYPE_HTML
public AbstractWebFrameworkView(WebFrameworkConfigElement webFrameworkConfiguration, ModelObjectService modelObjectService, ResourceService resourceService, RenderService renderService, TemplatesContainer templatesContainer)
webFrameworkConfiguration - WebFrameworkConfigElementmodelObjectService - ModelObjectServiceresourceService - ResourceServicerenderService - RenderServicetemplatesContainer - TemplatesContainerpublic AbstractWebFrameworkView(WebFrameworkServiceRegistry webFrameworkServiceRegistry)
This constructor is temporarily retained to support legacy applications that may depend on it. However, it has since been deprecated and should no longer be used for new implementations. The reason for the change is that Spring Surf was originally coded to have many dependencies upon static helper methods rather than using properly configured Spring beans. This is a problem because it inhibits flexibility and extensibility.
webFrameworkServiceRegistry - WebFrameworkServiceRegistrypublic URLHelperFactory getUrlHelperFactory()
public void setUrlHelperFactory(URLHelperFactory urlHelper)
public WebFrameworkConfigElement getWebFrameworkConfiguration()
Gets a WebFrameworkConfigElement.
WebFrameworkConfigElement stored in the WebFrameworkServiceRegistry (if this
view was instantiated using the deprecated constructor) or the WebFrameworkConfigElement supplied to
the non-deprecated constructorpublic ModelObjectService getObjectService()
Gets a ModelObjectService.
ModelObjectService stored in the WebFrameworkServiceRegistry (if this
view was instantiated using the deprecated constructor) or the ModelObjectService supplied to
the non-deprecated constructorpublic ResourceService getResourceService()
Gets a ResourceService.
ResourceService stored in the WebFrameworkServiceRegistry (if this
view was instantiated using the deprecated constructor) or the ResourceService supplied to
the non-deprecated constructorpublic TemplatesContainer getTemplatesContainer()
Returns the TemplatesContainer to be used by the view. In legacy mode this will always be the TemplatesContainer
stored in the WebFrameworkServiceRegistry (supplied in the constructor). However, if this view has been constructed
using the non-deprecated constructor then the TemplatesContainer returned will be the one supplied in the
constructor.
public RenderService getRenderService()
Returns the RenderService to be used by the view. In legacy mode this will always be the RenderService
stored in the WebFrameworkServiceRegistry (supplied in the constructor). However, if this view has been constructed
using the non-deprecated constructor then the RenderService returned will be the one supplied in the
constructor.
public Map<String,String> getUriTokens()
Get the URI tokens for the view
public void setUriTokens(Map<String,String> uriTokens)
Set the URI tokens associates with the view
uriTokens - A Map of name/value pairs derived from the URI associated with the view.protected void renderMergedOutputModel(Map<String,Object> mvcModel, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
This method must be implemented to actually render the view. One of the key functions of
this implementation is to retrieve the RequestContext instantiated by the
RequestContextInterceptor and complete it's initialisation.
renderMergedOutputModel in class org.springframework.web.servlet.view.AbstractViewExceptionprotected abstract void renderView(RequestContext context) throws Exception
context - the render contextExceptionprotected void exposeForwardRequestAttributes(javax.servlet.http.HttpServletRequest request)
request - the requestprotected void setupRequestContext(Map<String,Object> mvcModel, javax.servlet.http.HttpServletRequest request) throws Exception
mvcModel - Maprequest - HttpServletRequestExceptionprotected void populateRequestContext(RequestContext context, javax.servlet.http.HttpServletRequest request) throws Exception
context - RequestContextrequest - HttpServletRequestExceptionprotected void validateRequestContext(RequestContext context, javax.servlet.http.HttpServletRequest request) throws Exception
context - RequestContextrequest - HttpServletRequestExceptionprotected Page lookupPage(String pageId)
pageId - StringCopyright © 2005–2016 Alfresco Software. All rights reserved.