if (requestType.equals(HTTPRequestType.GET) &&
canRequestBeSatisfiedByCache(requestHeaders)) {
// try to read it from the dependency context first
HttpContent content = null;
if (xmlPipelineContext != null) {
final DependencyContext dependencyContext =
xmlPipelineContext.getDependencyContext();
if (dependencyContext != null) {
content = (HttpContent)
dependencyContext.removeProperty(keyUrl);
}
}
if (content == null) {
try {
// This path requests the page through the cache.
content = (HttpContent) cache.retrieve(keyUrl,
new HttpCacheableObjectProvider(
executor, cache.getRootGroup(), cache));
} catch (RuntimeHttpException e) {
throw (HTTPException) e.getCause();
}
}
respAccessor = new HttpContentWrapper(content);
dependency = content.getDependency();
} else {
// This path is for the types of request whose response should
// not be cached. POST and currently anything that is not
// a GET. We delegate directly to the target
// AbstractPluggableHTTPManager to get the data.
respAccessor = executor.execute();
dependency = UncacheableDependency.getInstance();
}
}
if (xmlPipelineContext != null) {
final DependencyContext dependencyContext =
xmlPipelineContext.getDependencyContext();
if (dependencyContext != null &&
dependencyContext.isTrackingDependencies()) {
dependencyContext.addDependency(dependency);
}
}
return respAccessor;
}