*/
private void setResponseCacheHeaders() {
final EnvironmentContext environmentContext =
context.getEnvironmentContext();
final ResponseCachingDirectives cachingDirectives =
environmentContext.getCachingDirectives();
if (cachingDirectives != null) {
// disable caching if dissection is used
if (isDissectionNeeded()) {
cachingDirectives.disable();
}
if (cachingDirectives.isEnabled() &&
!ResponseCachingDirectives.PRIORITY_NORMAL.isLower(
cachingDirectives.getExpiresPriority())) {
final XMLPipelineContext pipelineContext =
environmentContext.getPipelineContext();
final DependencyContext dependencyContext =
pipelineContext.getDependencyContext();
if (dependencyContext.isTrackingDependencies()) {
final Dependency dependency =
dependencyContext.extractDependency();
if (dependency.getCacheability() == Cacheability.CACHEABLE) {
cachingDirectives.setMaxAge(dependency.getTimeToLive(),
ResponseCachingDirectives.PRIORITY_NORMAL);
cachingDirectives.enable();
} else {
cachingDirectives.disable();
}
}
}
}
environmentContext.applyCachingDirectives();