Package com.adobe.granite.httpcache.api
Interface CacheHandler
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiononDeliver(String key, Headers headers, 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.onFetch(int status, Headers headers, HttpServletResponse response) Used upon receiving the response to determine whether the response is suitable for caching.onReceive(HttpServletRequest request) Used upon receiving a request to determine whether its response is suitable to be cached.
-
Method Details
-
onReceive
Used upon receiving a request to determine whether its response is suitable to be cached. The default handler will try caching the response if the method is GET and the request has no parameters.- Parameters:
request- request- Returns:
CacheHandler.TRI_STATE.YESto try caching the response;CacheHandler.TRI_STATE.NOto skip this request;CacheHandler.TRI_STATE.NEXT_HANDLERto ask the next handler
-
onDeliver
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 keyheaders- response headersresponse- response- Returns:
CacheHandler.TRI_STATE.YESto deliver the cache file;CacheHandler.TRI_STATE.NOto forbid delivering;CacheHandler.TRI_STATE.NEXT_HANDLERto ask the next handler
-
onFetch
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 isHttpServletResponse.SC_OKand if no cache control response header denies caching.- Parameters:
status- response statusheaders- response headers that will be stored along with the responseresponse- servlet response- Returns:
CacheHandler.TRI_STATE.YESto create an entry in the cacheCacheHandler.TRI_STATE.NOto forbid creating;CacheHandler.TRI_STATE.NEXT_HANDLERto ask the next handler
-