in src/main/java/org/apache/sling/security/impl/ContentDispositionFilter.java [214:266]
public void setContentType(String type) {
if (supportedMethods.contains(request.getMethod())) {
String previousContentType = (String) request.getAttribute(ATTRIBUTE_NAME);
if (previousContentType != null && previousContentType.equals(type)) {
super.setContentType(type);
return;
}
request.setAttribute(ATTRIBUTE_NAME, type);
String resourcePath = resource.getPath();
if (!contentDispositionExcludedPaths.contains(resourcePath)) {
if (enableContentDispositionAllPaths) {
setContentDisposition(resource);
} else {
boolean contentDispositionAdded = false;
if (contentDispositionPaths.contains(resourcePath)) {
if (contentTypesMapping.containsKey(resourcePath)) {
Set<String> exceptions = contentTypesMapping.get(resourcePath);
if (!exceptions.contains(type)) {
contentDispositionAdded = setContentDisposition(resource);
}
} else {
contentDispositionAdded = setContentDisposition(resource);
}
}
if (!contentDispositionAdded) {
for (String path : contentDispositionPathsPfx) {
if (resourcePath.startsWith(path)) {
if (contentTypesMapping.containsKey(path)) {
Set<String> exceptions = contentTypesMapping.get(path);
if (!exceptions.contains(type)) {
setContentDisposition(resource);
break;
}
} else {
setContentDisposition(resource);
break;
}
}
}
}
}
}
}
super.setContentType(type);
}