Class AbstractHttpCacheHandlingRule

java.lang.Object
com.adobe.acs.commons.httpcache.rule.AbstractHttpCacheHandlingRule
All Implemented Interfaces:
HttpCacheHandlingRule

public class AbstractHttpCacheHandlingRule extends Object implements HttpCacheHandlingRule
Utility abstract implementation providing default behavior for any cache handling rules.

All methods in this return true indicating that this does nothing other than instructing the HttpCacheEngine to move on with next rule. Any custom implementation could leverage this to facilitate overriding only the methods the custom rule is intended for.

  • Constructor Details

    • AbstractHttpCacheHandlingRule

      public AbstractHttpCacheHandlingRule()
  • Method Details

    • onRequestReceive

      public boolean onRequestReceive(org.apache.sling.api.SlingHttpServletRequest request)
      Description copied from interface: HttpCacheHandlingRule
      Hook to supply custom behavior on HttpCacheEngine receiving the request.
      Specified by:
      onRequestReceive in interface HttpCacheHandlingRule
      Returns:
      True represents success and cache handling rules will be continued. False represents failure with cache handling rules being stopped and fallback action will be taken.
    • onResponseCache

      public boolean onResponseCache(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, HttpCacheConfig cacheConfig, CacheContent cacheContent)
      Description copied from interface: HttpCacheHandlingRule
      Hook to supply custom behavior on HttpCacheEngine about to cache a response.
      Specified by:
      onResponseCache in interface HttpCacheHandlingRule
      cacheContent - Object carring data to be cached.
      Returns:
      True represents success and cache handling rules will be continued. False represents failure with cache handling rules being stopped and fallback action will be taken.
    • onCacheDeliver

      public boolean onCacheDeliver(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, HttpCacheConfig cacheConfig, CacheContent cacheContent)
      Description copied from interface: HttpCacheHandlingRule
      Hook to supply custom behavior on HttpCacheEngine delivering cache content after being read from cache store.
      Specified by:
      onCacheDeliver in interface HttpCacheHandlingRule
      cacheContent - Object carrying data to be delivered.
      Returns:
      True represents success and cache handling rules will be continued. False represents failure with cache handling rules being stopped and fallback action will be taken.
    • onCacheInvalidate

      public boolean onCacheInvalidate(String path)
      Description copied from interface: HttpCacheHandlingRule
      Hook to supply custom behavior on HttpCacheEngine invalidating cache for the changes in the given JCR repository path.
      Specified by:
      onCacheInvalidate in interface HttpCacheHandlingRule
      Parameters:
      path - JCR repository path
      Returns:
      True represents success and cache handling rules will be continued. False represents failure with cache handling rules being stopped and fallback action will be taken.