spring-projects / spring-projects/spring-data-rest
Support customizable Last-Modified and ETag headers [DATAREST-1197]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Stefan Fussenegger opened DATAREST-1197 and commented
Currently the Last-Modified header is generated from a field annotated with @LastModifiedDate and ETag from @Version.
Everytime the representation of the data changes (e.g. changed JSON property naming or added or removed properties) it would be very useful to "break" previous Last-Modified and ETag headers. This could be done by setting a minimum data (e.g. the startup time or build time) to properly handle If-Modified-Since requests while chaning the ETag accordingly (e.g. by using the timestamp as a prefix)
This currently is handled by HttpHeadersPreparer (which wans't configurable pre 3.0) but it seems like a feature worth adding.
By the way, I came across this while writing a read-only REST API for legacy data (i.e. Last-Modified never changes) that kept showing stale data in the browser
No further details from DATAREST-1197
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.