Class CacheAwareResponseHandler

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.support.WebContentGenerator
org.springframework.web.servlet.resource.ResourceHttpRequestHandler
org.broadleafcommerce.common.web.resource.BroadleafResourceHttpRequestHandler
org.broadleafcommerce.common.web.util.CacheAwareResponseHandler
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.EmbeddedValueResolverAware, org.springframework.web.context.ServletContextAware, org.springframework.web.cors.CorsConfigurationSource, org.springframework.web.HttpRequestHandler

public class CacheAwareResponseHandler extends BroadleafResourceHttpRequestHandler
Utility class that sets the correct response headers (especially browser cache related headers) using the existing Spring request pipeline configuration by mimetype. This is useful when circumventing Spring request handling for static files.
Author:
Jeff Fischer
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.broadleafcommerce.common.web.resource.BroadleafResourceHttpRequestHandler

    BroadleafResourceHttpRequestHandler.OrderedComparator
  • Field Summary

    Fields inherited from class org.broadleafcommerce.common.web.resource.BroadleafResourceHttpRequestHandler

    blcContextUtil, cacheSeconds

    Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator

    HEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POST
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    setHeaders(jakarta.servlet.http.HttpServletResponse response, File targetFile, String mimeType)
     

    Methods inherited from class org.broadleafcommerce.common.web.resource.BroadleafResourceHttpRequestHandler

    handleRequest, setHeaders, sortCollections

    Methods inherited from class org.springframework.web.servlet.resource.ResourceHttpRequestHandler

    afterPropertiesSet, getContentNegotiationManager, getCorsConfiguration, getEtagGenerator, getLocations, getMediaType, getMediaTypes, getResource, getResourceHttpMessageConverter, getResourceRegionHttpMessageConverter, getResourceResolvers, getResourceTransformers, getUrlPathHelper, initAllowedLocations, initContentNegotiationStrategy, isInvalidPath, isOptimizeLocations, isUseLastModified, processPath, setContentNegotiationManager, setCorsConfiguration, setEmbeddedValueResolver, setEtagGenerator, setLocations, setLocationValues, setMediaTypes, setOptimizeLocations, setResourceHttpMessageConverter, setResourceRegionHttpMessageConverter, setResourceResolvers, setResourceTransformers, setUrlPathHelper, setUseLastModified, toString

    Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator

    applyCacheControl, applyCacheSeconds, checkAndPrepare, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isRequireSession, prepareResponse, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setVaryByRequestHeaders

    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, obtainApplicationContext, requiredContextClass, setApplicationContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CacheAwareResponseHandler

      public CacheAwareResponseHandler()
  • Method Details

    • setHeaders

      public void setHeaders(jakarta.servlet.http.HttpServletResponse response, File targetFile, String mimeType) throws IOException
      Throws:
      IOException