java.lang.Object | |||
↳ | org.springframework.context.support.ApplicationObjectSupport | ||
↳ | org.springframework.web.context.support.WebApplicationObjectSupport | ||
↳ | org.springframework.web.servlet.view.AbstractCachingViewResolver |
Known Direct Subclasses |
Known Indirect Subclasses |
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.
Subclasses need to implement the loadView(String, Locale)
template method,
building the View object for a specific view name and locale.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.context.support.ApplicationObjectSupport
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clear the entire view cache, removing all cached view objects.
| |||||||||||
Return if caching is enabled.
| |||||||||||
Provides functionality to clear the cache for a certain view.
| |||||||||||
Resolve the given view by name.
| |||||||||||
Enable or disable caching.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create the actual View object.
| |||||||||||
Return the cache key for the given view name and the given locale.
| |||||||||||
Subclasses must implement this method, building a View object
for the specified view.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.web.context.support.WebApplicationObjectSupport
| |||||||||||
From class
org.springframework.context.support.ApplicationObjectSupport
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.context.ApplicationContextAware
| |||||||||||
From interface
org.springframework.web.context.ServletContextAware
| |||||||||||
From interface
org.springframework.web.servlet.ViewResolver
|
Clear the entire view cache, removing all cached view objects. Subsequent resolve calls will lead to recreation of demanded view objects.
Return if caching is enabled.
Provides functionality to clear the cache for a certain view.
This can be handy in case developer are able to modify views (e.g. Velocity templates) at runtime after which you'd need to clear the cache for the specified view.
viewName | the view name for which the cached view object (if any) needs to be removed |
---|---|
locale | the locale for which the view object should be removed |
Resolve the given view by name.
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).
viewName | name of the view to resolve |
---|---|
locale | Locale in which to resolve the view. ViewResolvers that support internationalization should respect this. |
null
if not found
(optional, to allow for ViewResolver chaining)Exception |
---|
Enable or disable caching.
Default is "true": caching is enabled. Disable this only for debugging and development.
Warning: Disabling caching can severely impact performance.
Create the actual View object.
The default implementation delegates to loadView(String, 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 |
null
if not found
(optional, to allow for ViewResolver chaining)Exception | if the view couldn't be resolved |
---|
Return the cache key for the given view name and the given locale.
Default is a String consisting of view name and locale suffix. Can be overridden in subclasses.
Needs to respect the locale in general, as a different locale can lead to a different view resource.
Subclasses must implement this method, building a View object for the specified view. The returned View objects will be cached by this ViewResolver base class.
Subclasses are not forced to support internationalization: A subclass that does not may simply ignore the locale parameter.
viewName | the name of the view to retrieve |
---|---|
locale | the Locale to retrieve the view for |
null
if not found
(optional, to allow for ViewResolver chaining)Exception | if the view couldn't be resolved |
---|