latestEtag = eTagHelper.get(url1);
} catch (InvalidTagException e) {
// ignore
}
if (latestEtag != null && clientEtag != null && clientEtag.equals(latestEtag)) {
return new ResponseEntity(null, new HttpHeaders(), HttpStatus.NOT_MODIFIED);
}
Object retVal = pjp.proceed();
ResponseEntity entity = (ResponseEntity) retVal;
HttpHeaders headers = new HttpHeaders();
String url = ServletUriComponentsBuilder.fromRequest(request).build().toString();
String tag = null;
try {
tag = eTagHelper.get(url);
} catch (InvalidTagException e) {
tag = eTagHelper.generate(url, entity.getBody());
}
headers.add("Etag", tag);
return new ResponseEntity(entity.getBody(), headers, entity.getStatusCode());
}