You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support conditional entity writing on client-side #100
Implemented and merged in the three maintained versions (3.0: #1695, 2.7: #1696, 2.6: #1697).
ClientResource now has per-call conditional writes, so a client can update or delete a resource only if it did not change since it was read, and create it only if it does not exist:
Conditions.unchangedSince(Response) builds If-Match from the strong entity tag that was read. Without one, it builds If-Unmodified-Since, but only if the modification date can be deduced to be strong (response Date at least one second after Last-Modified, RFC 9110 §8.8.2.2). Otherwise it throws IllegalArgumentException, so an unconditional write is never sent by accident.
ClientResource.put(...), patch(...) (entity as Representation or Object) and delete(...) have overloads taking a Conditions. The conditions apply to that call only, nothing sticks to the resource, and the call is never retried automatically. A failed condition is a 412 ResourceException.
An automatic mode (conditions added without being asked) was deliberately not added.
Related: #1694 (Tag(String) creates a weak tag, which never matches If-Match).
Activity
Add per-call conditional writes to ClientResource (#100) (#1695)
Add per-call conditional writes to ClientResource (#100) (#1696)
Add per-call conditional writes to ClientResource (#100) (#1697)
thboileau-git commentedon Nov 25, 2026
Implemented and merged in the three maintained versions (3.0: #1695, 2.7: #1696, 2.6: #1697).
ClientResourcenow has per-call conditional writes, so a client can update or delete a resource only if it did not change since it was read, and create it only if it does not exist:Conditions.unchangedSince(Response)buildsIf-Matchfrom the strong entity tag that was read. Without one, it buildsIf-Unmodified-Since, but only if the modification date can be deduced to be strong (responseDateat least one second afterLast-Modified, RFC 9110 §8.8.2.2). Otherwise it throwsIllegalArgumentException, so an unconditional write is never sent by accident.Conditions.ifAbsent()buildsIf-None-Match: *(create only).ClientResource.put(...),patch(...)(entity asRepresentationorObject) anddelete(...)have overloads taking aConditions. The conditions apply to that call only, nothing sticks to the resource, and the call is never retried automatically. A failed condition is a 412ResourceException.An automatic mode (conditions added without being asked) was deliberately not added.
Related: #1694 (
Tag(String)creates a weak tag, which never matchesIf-Match).