List of usage examples for org.apache.http.client.cache HttpCacheUpdateCallback HttpCacheUpdateCallback
HttpCacheUpdateCallback
From source file:org.apache.http.impl.client.cache.BasicHttpCache.java
void storeVariantEntry(final HttpHost target, final HttpRequest req, final HttpCacheEntry entry) throws IOException { final String parentURI = uriExtractor.getURI(target, req); final String variantURI = uriExtractor.getVariantURI(target, req, entry); storage.putEntry(variantURI, entry); HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() { public HttpCacheEntry update(HttpCacheEntry existing) throws IOException { return doGetUpdatedParentEntry(req.getRequestLine().getUri(), existing, entry, uriExtractor.getVariantKey(req, entry), variantURI); }// www . j a va 2 s . c o m }; try { storage.updateEntry(parentURI, callback); } catch (HttpCacheUpdateException e) { log.warn("Could not update key [" + parentURI + "]", e); } }
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);//from ww w . ja v a 2s . c o m } }; try { storage.updateEntry(parentCacheKey, callback); } catch (HttpCacheUpdateException e) { log.warn("Could not update key [" + parentCacheKey + "]", e); } }