public class AbstractTemplateViewResolver extends UrlBasedViewResolver
Provides a convenient way to specify AbstractTemplateView
's
exposure flags for request attributes, session attributes,
and Spring's macro helpers.
AbstractTemplateView
,
VelocityViewResolver
,
FreeMarkerViewResolver
Modifier and Type | Field and Description |
---|---|
private boolean |
allowRequestOverride |
private boolean |
allowSessionOverride |
private boolean |
exposeRequestAttributes |
private boolean |
exposeSessionAttributes |
private boolean |
exposeSpringMacroHelpers |
FORWARD_URL_PREFIX, REDIRECT_URL_PREFIX
DEFAULT_CACHE_LIMIT
logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
AbstractTemplateViewResolver() |
Modifier and Type | Method and Description |
---|---|
protected AbstractUrlBasedView |
buildView(java.lang.String viewName)
Creates a new View instance of the specified view class and configures it.
|
protected java.lang.Class |
requiredViewClass()
Return the required type of view for this resolver.
|
void |
setAllowRequestOverride(boolean allowRequestOverride)
Set whether HttpServletRequest attributes are allowed to override (hide)
controller generated model attributes of the same name.
|
void |
setAllowSessionOverride(boolean allowSessionOverride)
Set whether HttpSession attributes are allowed to override (hide)
controller generated model attributes of the same name.
|
void |
setExposeRequestAttributes(boolean exposeRequestAttributes)
Set whether all request attributes should be added to the
model prior to merging with the template.
|
void |
setExposeSessionAttributes(boolean exposeSessionAttributes)
Set whether all HttpSession attributes should be added to the
model prior to merging with the template.
|
void |
setExposeSpringMacroHelpers(boolean exposeSpringMacroHelpers)
Set whether to expose a RequestContext for use by Spring's macro library,
under the name "springMacroRequestContext".
|
canHandle, createView, getAttributesMap, getCacheKey, getContentType, getOrder, getPrefix, getRequestContextAttribute, getSuffix, getViewClass, getViewNames, initApplicationContext, isRedirectContextRelative, isRedirectHttp10Compatible, loadView, setAttributes, setAttributesMap, setContentType, setExposePathVariables, setOrder, setPrefix, setRedirectContextRelative, setRedirectHttp10Compatible, setRequestContextAttribute, setSuffix, setViewClass, setViewNames
clearCache, getCacheLimit, isCache, isCacheUnresolved, removeFromCache, resolveViewName, setCache, setCacheLimit, setCacheUnresolved
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
private boolean exposeRequestAttributes
private boolean allowRequestOverride
private boolean exposeSessionAttributes
private boolean allowSessionOverride
private boolean exposeSpringMacroHelpers
protected java.lang.Class requiredViewClass()
UrlBasedViewResolver
requiredViewClass
in class UrlBasedViewResolver
AbstractUrlBasedView
public void setExposeRequestAttributes(boolean exposeRequestAttributes)
public void setAllowRequestOverride(boolean allowRequestOverride)
public void setExposeSessionAttributes(boolean exposeSessionAttributes)
public void setAllowSessionOverride(boolean allowSessionOverride)
public void setExposeSpringMacroHelpers(boolean exposeSpringMacroHelpers)
protected AbstractUrlBasedView buildView(java.lang.String viewName) throws java.lang.Exception
UrlBasedViewResolver
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.
buildView
in class UrlBasedViewResolver
viewName
- the name of the view to buildjava.lang.Exception
- if the view couldn't be resolvedUrlBasedViewResolver.loadView(String, java.util.Locale)