List of usage examples for org.apache.http.impl.client.cache Variant getCacheKey
public String getCacheKey()
From source file:org.apache.http.impl.client.cache.BasicHttpCache.java
public void reuseVariantEntryFor(HttpHost target, final HttpRequest req, final Variant variant) throws IOException { final String parentCacheKey = uriExtractor.getURI(target, req); final HttpCacheEntry entry = variant.getEntry(); final String variantKey = uriExtractor.getVariantKey(req, entry); final String variantCacheKey = variant.getCacheKey(); HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() { public HttpCacheEntry update(HttpCacheEntry existing) throws IOException { return doGetUpdatedParentEntry(req.getRequestLine().getUri(), existing, entry, variantKey, variantCacheKey);// w w w.jav a 2s.c om } }; try { storage.updateEntry(parentCacheKey, callback); } catch (HttpCacheUpdateException e) { log.warn("Could not update key [" + parentCacheKey + "]", e); } }
From source file:org.apache.http.impl.client.cache.CachingExec.java
private HttpCacheEntry getUpdatedVariantEntry(final HttpHost target, final HttpRequestWrapper conditionalRequest, final Date requestDate, final Date responseDate, final CloseableHttpResponse backendResponse, final Variant matchingVariant, final HttpCacheEntry matchedEntry) throws IOException { HttpCacheEntry responseEntry = matchedEntry; try {/*w ww .j a v a 2s . c o m*/ responseEntry = responseCache.updateVariantCacheEntry(target, conditionalRequest, matchedEntry, backendResponse, requestDate, responseDate, matchingVariant.getCacheKey()); } catch (final IOException ioe) { log.warn("Could not update cache entry", ioe); } finally { backendResponse.close(); } return responseEntry; }
From source file:org.apache.http.impl.client.cache.CachingHttpAsyncClient.java
private HttpCacheEntry getUpdatedVariantEntry(final HttpHost target, final HttpRequest conditionalRequest, final Date requestDate, final Date responseDate, final HttpResponse backendResponse, final Variant matchingVariant, final HttpCacheEntry matchedEntry) { HttpCacheEntry responseEntry = matchedEntry; try {/*from w ww .j av a 2 s. c o m*/ responseEntry = this.responseCache.updateVariantCacheEntry(target, conditionalRequest, matchedEntry, backendResponse, requestDate, responseDate, matchingVariant.getCacheKey()); } catch (final IOException ioe) { this.log.warn("Could not update cache entry", ioe); } return responseEntry; }
From source file:org.apache.http.impl.client.cache.CachingHttpClient.java
private HttpCacheEntry getUpdatedVariantEntry(HttpHost target, HttpRequest conditionalRequest, Date requestDate, Date responseDate, HttpResponse backendResponse, Variant matchingVariant, HttpCacheEntry matchedEntry) { HttpCacheEntry responseEntry = matchedEntry; try {//from w ww . j av a 2 s . c om responseEntry = responseCache.updateVariantCacheEntry(target, conditionalRequest, matchedEntry, backendResponse, requestDate, responseDate, matchingVariant.getCacheKey()); } catch (IOException ioe) { log.warn("Could not update cache entry", ioe); } return responseEntry; }