ETagUtils

Helpers for HTTP ETag / If-Match handling in support of optimistic concurrency on REST endpoints.

The convention is: the JPA @Version column of an aggregate is exposed as a weak ETag (W/"<version>"); clients echo the value back on mutating requests via If-Match, and the adapter feeds the parsed version into OptimisticLockingValidatorUtils.validate before applying the change.

Functions

Link copied to clipboard
fun buildWeakETag(version: Long?): String?

Builds a weak ETag of the form W/"<version>" for the given nullable JPA @Version value. Returns null when version is null so callers can transparently propagate "no version" semantics.

Link copied to clipboard

Parses an If-Match header value back into a Long version, tolerating both weak (W/"42") and strong ("42") forms as well as bare numeric values. Returns null when the header is missing, blank, or not parseable.