Class ETagWebRequestor
- All Implemented Interfaces:
- WebRequestor
 The ETagWebRequestor caches all GET-requests with an ETag header field in a SoftHashMap and
 uses the ETag on the next request as If-None-Match header field if the same URL is requested.
 
Is the response status code 304 (NOT MODIFIED) the old response from cache is used.
Attention: even 304 responses count as request at Facebook and so they count against the throttling limits. Facebook suggests to use them for data that change only frequently
Further information regarding ETag at Facebook can be found here: https://developers.facebook.com/blog/post/627/
 Attention 2: If excessively used with a lot of URLs, the SoftHashMap can lead to a
 performance degradation
 
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class com.restfb.DefaultWebRequestorDefaultWebRequestor.HttpMethodNested classes/interfaces inherited from interface com.restfb.WebRequestorWebRequestor.Request, WebRequestor.Response
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcustomizeConnection(HttpURLConnection connection) Hook method which allows subclasses to easily customize theconnections created byDefaultWebRequestor.executeGet(com.restfb.WebRequestor.Request)andDefaultWebRequestor.executePost(com.restfb.WebRequestor.Request)- for example, setting a custom read timeout or request header.protected WebRequestor.ResponsefetchResponse(HttpURLConnection httpUrlConnection) booleanreturn if cache is used.static voidsetMapSupplier(Supplier<Map<String, ETagWebRequestor.ETagResponse>> mapSupplier) Override the mapSupplier, it needs to be some implementation of theMapinterface.voidsetUseCache(boolean useCache) activate/deactivate the ETag-Cache for the next request.Methods inherited from class com.restfb.DefaultWebRequestorcloseQuietly, closeQuietly, createFormFieldName, executeDelete, executeGet, executePost, fillHeaderAndDebugInfo, getCurrentHeaders, getDebugHeaderInfo, initHeaderAccessToken, isAutocloseBinaryAttachmentStream, openConnection, setAutocloseBinaryAttachmentStream, write
- 
Constructor Details- 
ETagWebRequestorpublic ETagWebRequestor()
 
- 
- 
Method Details- 
customizeConnectionDescription copied from class:DefaultWebRequestorHook method which allows subclasses to easily customize theconnections created byDefaultWebRequestor.executeGet(com.restfb.WebRequestor.Request)andDefaultWebRequestor.executePost(com.restfb.WebRequestor.Request)- for example, setting a custom read timeout or request header.This implementation is a no-op. - Overrides:
- customizeConnectionin class- DefaultWebRequestor
- Parameters:
- connection- The connection to customize.
 
- 
fetchResponseprotected WebRequestor.Response fetchResponse(HttpURLConnection httpUrlConnection) throws IOException - Overrides:
- fetchResponsein class- DefaultWebRequestor
- Throws:
- IOException
 
- 
isUseCachereturn if cache is used.- Returns:
- trueif ETag-Cache is used,- falseif not
 
- 
setUseCacheactivate/deactivate the ETag-Cache for the next request.when deactivated, the ETag-Cache is *not* deleted - Parameters:
- useCache- flag to dis/enable the cache during runtime
 
- 
setMapSupplierOverride the mapSupplier, it needs to be some implementation of theMapinterface.You have to set this before the ETagWebRequestorobject is created. While building it, the mapSupplier is used- Parameters:
- mapSupplier- the supplier, that returns a new Map,
 
 
-