org.springframework.web.servlet.view
Class AbstractCachingViewResolver

org.springframework.context.support.ApplicationObjectSupport
  |
  +--org.springframework.web.context.support.WebApplicationObjectSupport
        |
        +--org.springframework.web.servlet.view.AbstractCachingViewResolver
Direct Known Subclasses:
ResourceBundleViewResolver, UrlBasedViewResolver, XmlViewResolver

public abstract class AbstractCachingViewResolver
extends WebApplicationObjectSupport
implements ViewResolver

Convenient superclass for view resolvers. Caches views once resolved. This means that view resolution won't be a performance problem, no matter how costly initial view retrieval is.

View retrieval is deferred to subclasses via the loadView template method.

Author:
Rod Johnson, Juergen Hoeller
See Also: loadView(java.lang.String,java.util.Locale)

Method Summary
 booleanisCache()
          Return if caching is enabled.
 ViewresolveViewName(String viewName, Locale locale)
           
 voidsetCache(boolean cache)
          Enable caching.

Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, setApplicationContext

Method Detail

isCache

public boolean isCache()
Return if caching is enabled.

resolveViewName

public View resolveViewName(String viewName, Locale locale)
throws java.lang.Exception

setCache

public void setCache(boolean cache)
Enable caching. Disable this only for debugging and development. Default is for caching to be enabled.

Warning: Disabling caching severely impacts performance. Tests indicate that turning caching off reduces performance by at least 20%. Increased object churn probably eventually makes the problem even worse.

Association Links

to Class java.util.Map

View name --> View instance