Package com.adobe.granite.httpcache.api
Interface CacheHandler
-
@ProviderType public interface CacheHandler
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCacheHandler.TRI_STATETri-State type.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CacheHandler.TRI_STATEonDeliver(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_STATEonFetch(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_STATEonReceive(javax.servlet.http.HttpServletRequest request)Used upon receiving a request to determine whether its response is suitable to be cached.
-
-
-
Method Detail
-
onReceive
CacheHandler.TRI_STATE onReceive(javax.servlet.http.HttpServletRequest request)
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
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 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
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 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
-
-