Interface ResourceFactory
- All Known Implementing Classes:
FileResourceFactory, HeapResourceFactory
@Contract(threading=STATELESS)
public interface ResourceFactory
Generates
Resource instances for handling cached
HTTP response bodies.- Since:
- 4.1
-
Method Details
-
generate
Creates aResourcefrom a given response body.- Parameters:
requestId- a unique identifier for this particular response body.content- byte array that represents the origin HTTP response body.- Returns:
- a
Resourcecontaining however much of the response body was successfully read. - Throws:
ResourceIOException
-
generate
Creates aResourcefrom a given response body.- Parameters:
requestId- a unique identifier for this particular response body.content- byte array that represents the origin HTTP response body.off- the start offset in the array.len- the number of bytes to read from the array.- Returns:
- a
Resourcecontaining however much of the response body was successfully read. - Throws:
ResourceIOException
-
generate
default Resource generate(String requestId, String eTag, byte[] content, int off, int len) throws ResourceIOException Creates aResourcefrom a given response body.- Parameters:
requestId- a unique identifier for this particular response body.eTag- eTag Strong (unique) identifier for the resource entity with the given requestId, ornullwhen not given or is weak (non-unique).content- byte array that represents the origin HTTP response body.off- the start offset in the array.len- the number of bytes to read from the array.- Returns:
- a
Resourcecontaining however much of the response body was successfully read. - Throws:
ResourceIOException
-
copy
Deprecated.Do not use.- Throws:
ResourceIOException
-