preview cache header
This commit is contained in:
parent
55b1af9242
commit
3dcafdd46a
@ -94,6 +94,12 @@ public class PictureController {
|
||||
log.warn("Tried accessing NON-EXISTENT picture: {}", request);
|
||||
return new ResponseStatusException(HttpStatus.NOT_FOUND);
|
||||
});
|
||||
|
||||
final int cacheDuration = 30 * 24 * 60 * 60;
|
||||
response.setHeader("Cache-Control", "public, max-age=" + cacheDuration);
|
||||
response.setDateHeader("Expires", System.currentTimeMillis() + (cacheDuration * 1000L));
|
||||
response.setDateHeader("Last-Modified", System.currentTimeMillis());
|
||||
|
||||
try (final FileInputStream input = new FileInputStream(pictureDto.getPreviewPath().toFile())) {
|
||||
response.getOutputStream().write(input.readAllBytes());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user