Top Description Fields Constructors Methods
org.springframework.web.servlet.view

public abstract Class AbstractTemplateViewResolver

extends UrlBasedViewResolver
Class Inheritance
Known Direct Subclasses
org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver, org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver

Abstract base class for template view resolvers, in particular for FreeMarker views.

Provides a convenient way to specify AbstractTemplateView's exposure flags for request attributes, session attributes, and Spring's macro helpers.

Author
Juergen Hoeller
Since
1.1
See Also
AbstractTemplateView, org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean
private boolean
private boolean
Inherited from org.springframework.web.servlet.view.UrlBasedViewResolver:
FORWARD_URL_PREFIXREDIRECT_URL_PREFIX

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected AbstractUrlBasedView
buildView(String
the name of the view to build
viewName
)

Overrides org.springframework.web.servlet.view.UrlBasedViewResolver.buildView.

Creates a new View instance of the specified view class and configures it.

protected Class<?>
requiredViewClass()

Overrides org.springframework.web.servlet.view.UrlBasedViewResolver.requiredViewClass.

Return the required type of view for this resolver.

public void
setAllowRequestOverride(boolean allowRequestOverride)

Set whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name.

public void
setAllowSessionOverride(boolean allowSessionOverride)

Set whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name.

public void
setExposeRequestAttributes(boolean exposeRequestAttributes)

Set whether all request attributes should be added to the model prior to merging with the template.

public void
setExposeSessionAttributes(boolean exposeSessionAttributes)

Set whether all HttpSession attributes should be added to the model prior to merging with the template.

public void
setExposeSpringMacroHelpers(boolean exposeSpringMacroHelpers)

Set whether to expose a RequestContext for use by Spring's macro library, under the name "springMacroRequestContext".

Inherited from org.springframework.web.servlet.view.UrlBasedViewResolver:
applyLifecycleMethodscanHandlecreateViewgetAttributesMapgetCacheKeygetContentTypegetExposeContextBeansAsAttributesgetExposedContextBeanNamesgetExposePathVariablesgetOrdergetPrefixgetRedirectHostsgetRequestContextAttributegetSuffixgetViewClassgetViewNamesinitApplicationContextinstantiateViewisRedirectContextRelativeisRedirectHttp10CompatibleloadViewsetAttributessetAttributesMapsetContentTypesetExposeContextBeansAsAttributessetExposedContextBeanNamessetExposePathVariablessetOrdersetPrefixsetRedirectContextRelativesetRedirectHostssetRedirectHttp10CompatiblesetRequestContextAttributesetSuffixsetViewClasssetViewNames

Field Detail

allowRequestOverrideback to summary
private boolean allowRequestOverride
allowSessionOverrideback to summary
private boolean allowSessionOverride
exposeRequestAttributesback to summary
private boolean exposeRequestAttributes
exposeSessionAttributesback to summary
private boolean exposeSessionAttributes
exposeSpringMacroHelpersback to summary
private boolean exposeSpringMacroHelpers

Constructor Detail

AbstractTemplateViewResolverback to summary
public AbstractTemplateViewResolver()

Method Detail

buildViewback to summary
protected AbstractUrlBasedView buildView(String viewName) throws Exception

Overrides org.springframework.web.servlet.view.UrlBasedViewResolver.buildView.

Doc from org.springframework.web.servlet.view.UrlBasedViewResolver.buildView.

Creates a new View instance of the specified view class and configures it. Does not perform any lookup for pre-defined View instances.

Spring lifecycle methods as defined by the bean container do not have to be called here; those will be applied by the loadView method after this method returns.

Subclasses will typically call super.buildView(viewName) first, before setting further properties themselves. loadView will then apply Spring lifecycle methods at the end of this process.

Parameters
viewName:String

the name of the view to build

Returns:AbstractUrlBasedView

the View instance

Annotations
@Override
Exceptions
Exception:
if the view couldn't be resolved
requiredViewClassback to summary
protected Class<?> requiredViewClass()

Overrides org.springframework.web.servlet.view.UrlBasedViewResolver.requiredViewClass.

Doc from org.springframework.web.servlet.view.UrlBasedViewResolver.requiredViewClass.

Return the required type of view for this resolver. This implementation returns AbstractUrlBasedView.

Annotations
@Override
setAllowRequestOverrideback to summary
public void setAllowRequestOverride(boolean allowRequestOverride)

Set whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name. Default is "false", which causes an exception to be thrown if request attributes of the same name as model attributes are found.

See Also
AbstractTemplateView#setAllowRequestOverride
setAllowSessionOverrideback to summary
public void setAllowSessionOverride(boolean allowSessionOverride)

Set whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name. Default is "false", which causes an exception to be thrown if session attributes of the same name as model attributes are found.

See Also
AbstractTemplateView#setAllowSessionOverride
setExposeRequestAttributesback to summary
public void setExposeRequestAttributes(boolean exposeRequestAttributes)

Set whether all request attributes should be added to the model prior to merging with the template. Default is "false".

See Also
AbstractTemplateView#setExposeRequestAttributes
setExposeSessionAttributesback to summary
public void setExposeSessionAttributes(boolean exposeSessionAttributes)

Set whether all HttpSession attributes should be added to the model prior to merging with the template. Default is "false".

See Also
AbstractTemplateView#setExposeSessionAttributes
setExposeSpringMacroHelpersback to summary
public void setExposeSpringMacroHelpers(boolean exposeSpringMacroHelpers)

Set whether to expose a RequestContext for use by Spring's macro library, under the name "springMacroRequestContext". Default is "true".

See Also
AbstractTemplateView#setExposeSpringMacroHelpers