Class 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean useNullSentinel
      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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearCache()
      Override the SpringMVC default caching strategy with one that uses a ConcurrentHashMap impl.
      void removeFromCache​(java.lang.String viewName, java.util.Locale locale)
      Override the SpringMVC default caching strategy with one that uses a ConcurrentHashMap impl.
      org.springframework.web.servlet.View resolveViewName​(java.lang.String viewName, java.util.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

        buildView, canHandle, createView, getAttributesMap, getCacheKey, getContentType, getExposePathVariables, getOrder, getPrefix, getRequestContextAttribute, getSuffix, getViewClass, getViewNames, initApplicationContext, isRedirectContextRelative, isRedirectHttp10Compatible, loadView, requiredViewClass, setAttributes, setAttributesMap, setContentType, setExposePathVariables, setOrder, setPrefix, setRedirectContextRelative, setRedirectHttp10Compatible, setRequestContextAttribute, setSuffix, setViewClass, setViewNames
      • Methods inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver

        getCacheLimit, isCache, isCacheUnresolved, setCache, 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, requiredContextClass, setApplicationContext
      • Methods inherited from class java.lang.Object

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

      • useNullSentinel

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

      • AbstractWebScriptViewResolver

        public AbstractWebScriptViewResolver()
    • Method Detail

      • resolveViewName

        public org.springframework.web.servlet.View resolveViewName​(java.lang.String viewName,
                                                                    java.util.Locale locale)
                                                             throws java.lang.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:
        java.lang.Exception
      • removeFromCache

        public void removeFromCache​(java.lang.String viewName,
                                    java.util.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