Class AbstractWebScriptViewResolver

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractCachingViewResolver
org.springframework.web.servlet.view.UrlBasedViewResolver
org.springframework.extensions.webscripts.servlet.mvc.AbstractWebScriptViewResolver
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.ViewResolver
Direct Known Subclasses:
WebScriptViewResolver

public abstract class AbstractWebScriptViewResolver extends org.springframework.web.servlet.view.UrlBasedViewResolver
Base View Resolver class providing an improved caching strategy over the basic SpringMVC UrlBasedViewResolver. Removes the need to synchronize on the view cache object for each lookup, also caches "null" view lookups which in reality happen more often than not for most view resolvers.
Author:
Kevin Roast
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver

    org.springframework.web.servlet.view.AbstractCachingViewResolver.CacheFilter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    True if the resolver should cache "null" lookups

    Fields inherited from class org.springframework.web.servlet.view.UrlBasedViewResolver

    FORWARD_URL_PREFIX, REDIRECT_URL_PREFIX

    Fields inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver

    DEFAULT_CACHE_LIMIT

    Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

    logger

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Override the SpringMVC default caching strategy with one that uses a ConcurrentHashMap impl.
    void
    removeFromCache(String viewName, Locale locale)
    Override the SpringMVC default caching strategy with one that uses a ConcurrentHashMap impl.
    org.springframework.web.servlet.View
    resolveViewName(String viewName, Locale locale)
    Override the SpringMVC default caching strategy with one that uses a ConcurrentHashMap impl.

    Methods inherited from class org.springframework.web.servlet.view.UrlBasedViewResolver

    applyLifecycleMethods, buildView, canHandle, createView, getAttributesMap, getCacheKey, getContentType, getExposeContextBeansAsAttributes, getExposedContextBeanNames, getExposePathVariables, getOrder, getPrefix, getRedirectHosts, getRequestContextAttribute, getSuffix, getViewClass, getViewNames, initApplicationContext, instantiateView, isRedirectContextRelative, isRedirectHttp10Compatible, loadView, requiredViewClass, setAttributes, setAttributesMap, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setOrder, setPrefix, setRedirectContextRelative, setRedirectHosts, setRedirectHttp10Compatible, setRequestContextAttribute, setSuffix, setViewClass, setViewNames

    Methods inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver

    getCacheFilter, getCacheLimit, isCache, isCacheUnresolved, setCache, setCacheFilter, setCacheLimit, setCacheUnresolved

    Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

    getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext

    Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

    getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • useNullSentinel

      protected boolean useNullSentinel
      True if the resolver should cache "null" lookups
  • Constructor Details

    • AbstractWebScriptViewResolver

      public AbstractWebScriptViewResolver()
  • Method Details

    • resolveViewName

      public org.springframework.web.servlet.View resolveViewName(String viewName, Locale locale) throws Exception
      Override the SpringMVC default caching strategy with one that uses a ConcurrentHashMap impl.
      Specified by:
      resolveViewName in interface org.springframework.web.servlet.ViewResolver
      Overrides:
      resolveViewName in class org.springframework.web.servlet.view.AbstractCachingViewResolver
      Throws:
      Exception
    • removeFromCache

      public void removeFromCache(String viewName, Locale locale)
      Override the SpringMVC default caching strategy with one that uses a ConcurrentHashMap impl.
      Overrides:
      removeFromCache in class org.springframework.web.servlet.view.AbstractCachingViewResolver
    • clearCache

      public void clearCache()
      Override the SpringMVC default caching strategy with one that uses a ConcurrentHashMap impl.
      Overrides:
      clearCache in class org.springframework.web.servlet.view.AbstractCachingViewResolver