Package com.adobe.granite.httpcache.api
Interface CacheFile
A cache file contains the response headers and body that can be delivered
on subsequent requests for the same resource.
TODO: currently there are methods that only makes sense while either using
an existing cache file or creating a new one: it might be more
appropriate to create separate interfaces for that.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddiscard()Discard this cache file.Return the HTTP response headers stored with this entry.getKey()Return the cache key.Open an output stream that will contain a copy of the response body.getWriter(PrintWriter base, String encoding) Open a print writer.booleansave()Keep this cache file.voidspool(HttpServletResponse response) Spool the cache file's contents to a response.
-
Method Details
-
getKey
String getKey()Return the cache key.- Returns:
- cache key
-
getHeaders
Headers getHeaders()Return the HTTP response headers stored with this entry.- Returns:
- response headers
-
spool
Spool the cache file's contents to a response.- Parameters:
response- servlet response- Throws:
IOException- if an I/O error occurs
-
getOutputStream
Open an output stream that will contain a copy of the response body.- Parameters:
base- base output stream- Returns:
- servlet output stream
- Throws:
IOException- if an I/O error occurs
-
getWriter
Open a print writer.- Parameters:
base- base writerencoding- response body encoding- Returns:
- writer
- Throws:
IOException- if an I/O error occurs
-
save
boolean save()Keep this cache file.- Returns:
trueif the save was successful;falseotherwise
-
discard
void discard()Discard this cache file.
-