Interface CacheHandler


  • @ProviderType
    public interface CacheHandler
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  CacheHandler.TRI_STATE
      Tri-State type.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      CacheHandler.TRI_STATE onDeliver​(java.lang.String key, Headers headers, javax.servlet.http.HttpServletResponse response)
      Used after a cache hit to give a cache handler the opportunity to modify the response headers being delivered, or forbid delivering the cache file.
      CacheHandler.TRI_STATE onFetch​(int status, Headers headers, javax.servlet.http.HttpServletResponse response)
      Used upon receiving the response to determine whether the response is suitable for caching.
      CacheHandler.TRI_STATE onReceive​(javax.servlet.http.HttpServletRequest request)
      Used upon receiving a request to determine whether its response is suitable to be cached.
    • Method Detail

      • onDeliver

        CacheHandler.TRI_STATE onDeliver​(java.lang.String key,
                                         Headers headers,
                                         javax.servlet.http.HttpServletResponse response)
        Used after a cache hit to give a cache handler the opportunity to modify the response headers being delivered, or forbid delivering the cache file. The default handler will unconditionally deliver a cache hit.
        Parameters:
        key - cache key
        headers - response headers
        response - response
        Returns:
        CacheHandler.TRI_STATE.YES to deliver the cache file; CacheHandler.TRI_STATE.NO to forbid delivering; CacheHandler.TRI_STATE.NEXT_HANDLER to ask the next handler
      • onFetch

        CacheHandler.TRI_STATE onFetch​(int status,
                                       Headers headers,
                                       javax.servlet.http.HttpServletResponse response)
        Used upon receiving the response to determine whether the response is suitable for caching. The default handler will create a cache entry if the response status is HttpServletResponse.SC_OK and if no cache control response header denies caching.
        Parameters:
        status - response status
        headers - response headers that will be stored along with the response
        response - servlet response
        Returns:
        CacheHandler.TRI_STATE.YES to create an entry in the cache CacheHandler.TRI_STATE.NO to forbid creating; CacheHandler.TRI_STATE.NEXT_HANDLER to ask the next handler