Tag(String) creates a weak tag: servers silently disable If-Match concurrency control
Problem
new Tag("v1") creates a weak entity tag (Tag.java: Tag(String opaqueTag) calls this(opaqueTag, true)); a strong tag needs new Tag("v1", false).
RFC 9110 §8.8.3 says an entity tag is strong unless it carries the W/ prefix, and §13.1.1 requires strong comparison for If-Match: a weak tag can never match. So a server that sets representation.setTag(new Tag("v1")) sends ETag: W/"v1", and every client that sends If-Match: W/"v1" (or the tag it read) gets a 412 forever, or, if the server skips the check, loses the lost-update protection. Nothing tells the developer why. Also relevant for PATCH (RFC 5789 §2: SHOULD use a strong tag).
Found while analysing #100 (client-side conditional writes): a GET returned a weak tag and the conditional PUT built from it never succeeded.
Proposal (3.0 only, breaking)
- Make
Tag(String)create a strong tag (andTag()), keepnew Tag(name, true)for weak ones; document it and list it in the 3.0 breaking changes. - 2.x keeps the current behaviour (changing it would silently alter the
ETagheader of existing servers); Javadoc warning only there, if wanted.
Open point: Tag.parse already handles W/ correctly.