Convenient base class for ViewResolver
implementations. Caches View objects
once resolved: This means that view resolution won't be a performance problem,
no matter how costly initial view retrieval is.
Specify the maximum number of entries for the view cache.
Default is 1024.
public int getCacheLimit()
Return the maximum number of entries for the view cache.
public void setCache(boolean cache)
Enable or disable caching.
This is equivalent to setting the "cacheLimit"
property to the default limit (1024) or to 0, respectively.
Default is "true": caching is enabled.
Disable this only for debugging and development.
public boolean isCache()
Return if caching is enabled.
public void setCacheUnresolved(boolean cacheUnresolved)
Whether a view name once resolved to null should be cached and
automatically resolved to null subsequently.
Default is "true": unresolved view names are being cached, as of Spring 3.1.
Note that this flag only applies if the general "cache"
flag is kept at its default of "true" as well.
Of specific interest is the ability for some AbstractUrlBasedView
implementations (FreeMarker, Tiles) to check if an underlying resource
exists via AbstractUrlBasedView.checkResource(Locale).
With this flag set to "false", an underlying resource that re-appears
is noticed and used. With the flag set to "true", one check is made only.
public boolean isCacheUnresolved()
Return if caching of unresolved views is enabled.
public View resolveViewName(java.lang.String viewName,
Note: To allow for ViewResolver chaining, a ViewResolver should
return null if a view with the given name is not defined in it.
However, this is not required: Some ViewResolvers will always attempt
to build View objects with the given name, unable to return null
(rather throwing an exception when View creation failed).
The default implementation delegates to loadView(java.lang.String, java.util.Locale).
This can be overridden to resolve certain view names in a special fashion,
before delegating to the actual loadView implementation
provided by the subclass.
viewName - the name of the view to retrieve
locale - the Locale to retrieve the view for
the View instance, or null if not found
(optional, to allow for ViewResolver chaining)
java.lang.Exception - if the view couldn't be resolved