#182: do not cache the temporary thumbnail

This commit is contained in:
Benjamin Gamard 2018-03-14 19:01:28 +01:00
parent dcb924abac
commit 2ac10e8127

View File

@ -525,12 +525,19 @@ public class FileResource extends BaseResource {
return Response.status(Status.SERVICE_UNAVAILABLE).build();
}
return Response.ok(stream)
Response.ResponseBuilder builder = Response.ok(stream)
.header(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=" + file.getFullName("data"))
.header(HttpHeaders.CONTENT_TYPE, mimeType)
.header(HttpHeaders.CACHE_CONTROL, "private")
.header(HttpHeaders.EXPIRES, HttpUtil.buildExpiresHeader(3_600_000L * 24L * 365L))
.build();
.header(HttpHeaders.CONTENT_TYPE, mimeType);
if (decrypt) {
// Cache real files
builder.header(HttpHeaders.CACHE_CONTROL, "private")
.header(HttpHeaders.EXPIRES, HttpUtil.buildExpiresHeader(3_600_000L * 24L * 365L));
} else {
// Do not cache the temporary thumbnail
builder.header(HttpHeaders.CACHE_CONTROL, "no-store, must-revalidate")
.header(HttpHeaders.EXPIRES, "0");
}
return builder.build();
}
/**