spring-projects / spring-projects/spring-data-rest

Support customizable Last-Modified and ETag headers [DATAREST-1197]

Open
#1,516 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.