|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.context.support.ApplicationObjectSupport org.springframework.web.context.support.WebApplicationObjectSupport org.springframework.web.servlet.view.AbstractCachingViewResolver
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.
loadView(java.lang.String, java.util.Locale)
Field Summary |
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
logger |
Constructor Summary | |
AbstractCachingViewResolver()
|
Method Summary | |
protected java.lang.String |
getCacheKey(java.lang.String viewName,
java.util.Locale locale)
Return the cache key for the given viewName and the given locale. |
boolean |
isCache()
Return if caching is enabled. |
protected abstract View |
loadView(java.lang.String viewName,
java.util.Locale locale)
Subclasses must implement this method. |
View |
resolveViewName(java.lang.String viewName,
java.util.Locale locale)
Resolve the given view by name. |
void |
setCache(boolean cache)
Enable respectively disable caching. |
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
getServletContext, getTempDir, getWebApplicationContext, requiredContextClass |
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
getApplicationContext, getMessageSourceAccessor, initApplicationContext, setApplicationContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractCachingViewResolver()
Method Detail |
public void setCache(boolean cache)
Warning: Disabling caching can severely impact performance. Tests indicate that turning caching off reduces performance by at least 20%. Increased object churn probably eventually makes the problem even worse.
public boolean isCache()
public View resolveViewName(java.lang.String viewName, java.util.Locale locale) throws java.lang.Exception
ViewResolver
resolveViewName
in interface ViewResolver
viewName
- name of the view to resolvelocale
- Locale in which to resolve the view.
ViewResolvers that support internationalization should respect this.
java.lang.Exception
- if the view cannot be resolvedprotected java.lang.String getCacheKey(java.lang.String viewName, java.util.Locale locale)
protected abstract View loadView(java.lang.String viewName, java.util.Locale locale) throws java.lang.Exception
viewName
- the name of the view to retrievelocale
- the Locale to retrieve the view for
java.lang.Exception
- if the view couldn't be resolved
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |