org.broadleafcommerce.core.web.interceptor
Class NonResourceWebContentInterceptor

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.support.WebContentGenerator
              extended by org.springframework.web.servlet.mvc.WebContentInterceptor
                  extended by org.broadleafcommerce.core.web.interceptor.NonResourceWebContentInterceptor
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.HandlerInterceptor

public class NonResourceWebContentInterceptor
extends org.springframework.web.servlet.mvc.WebContentInterceptor

This class is used to control the cache seconds. The default Spring WebContentInterceptor will apply the cacheSeconds and associated variables to everything that goes through Spring MVC. We only want to apply the configured cache settings to requests that go through controllers. For static resources, we will let Spring use its defaults. Additionally, for requests for files that are known bundles, we will cache for a full 10 years, as we are generating unique filenames that will make this acceptable.

Author:
Andre Azzolini (apazzolini)

Field Summary
protected static int TEN_YEARS_SECONDS
           
 
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator
METHOD_GET, METHOD_HEAD, METHOD_POST
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
NonResourceWebContentInterceptor()
           
 
Method Summary
 boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler)
           
 
Methods inherited from class org.springframework.web.servlet.mvc.WebContentInterceptor
afterCompletion, lookupCacheSeconds, postHandle, setAlwaysUseFullPath, setCacheMappings, setPathMatcher, setUrlDecode, setUrlPathHelper
 
Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setAlwaysMustRevalidate, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader
 
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, initApplicationContext, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEN_YEARS_SECONDS

protected static final int TEN_YEARS_SECONDS
See Also:
Constant Field Values
Constructor Detail

NonResourceWebContentInterceptor

public NonResourceWebContentInterceptor()
Method Detail

preHandle

public boolean preHandle(javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response,
                         Object handler)
                  throws javax.servlet.ServletException
Specified by:
preHandle in interface org.springframework.web.servlet.HandlerInterceptor
Overrides:
preHandle in class org.springframework.web.servlet.mvc.WebContentInterceptor
Throws:
javax.servlet.ServletException


Copyright © 2013. All Rights Reserved.