Package com.adobe.granite.httpcache.api
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, 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, HttpServletResponse response)
Used upon receiving the response to determine whether the response is suitable for caching.CacheHandler.TRI_STATE
onReceive(HttpServletRequest request)
Used upon receiving a request to determine whether its response is suitable to be cached.
-
-
-
Method Detail
-
onReceive
CacheHandler.TRI_STATE onReceive(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.YES
to try caching the response;CacheHandler.TRI_STATE.NO
to skip this request;CacheHandler.TRI_STATE.NEXT_HANDLER
to ask the next handler
-
onDeliver
CacheHandler.TRI_STATE onDeliver(java.lang.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. The default handler will unconditionally deliver a cache hit.- Parameters:
key
- cache keyheaders
- response headersresponse
- 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, 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_OK
and 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.YES
to create an entry in the cacheCacheHandler.TRI_STATE.NO
to forbid creating;CacheHandler.TRI_STATE.NEXT_HANDLER
to ask the next handler
-
-