Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Changes log
- `CacheDirective.noCache(String)`, `noCache(List)`, `privateInfo(String)` and `privateInfo(List)` produced a doubly quoted value (`no-cache="\"Set-Cookie\""`), and a list was written as one quoted name per element. The directive value now holds the raw field names (`Set-Cookie`, or `Set-Cookie, Authorization` for a list, no quotes), and `CacheDirectiveWriter` writes them as a single quoted-string (`no-cache="Set-Cookie, Authorization"`), as required by RFC 9111 section 5.2.2.4. Code reading `getValue()` of these directives no longer sees the quotes. Issue #745.

- Enhancements
- Documented that `new Tag()` and `new Tag(String)` create a weak entity tag, which is written as `W/"value"` and never matches an `If-Match` or `If-Range` condition: use `new Tag(value, false)` for a strong tag. The behaviour is unchanged. Issue #1694.
- `Redirector.MODE_CLIENT_PERMANENT_STRICT` answers 308 (Permanent Redirect), which makes the client repeat the request with the same method and content, unlike `MODE_CLIENT_PERMANENT` (301) that lets a user agent turn a POST into a GET. It comes with `Response.redirectPermanentStrict(...)`, `ServerResource.redirectPermanentStrict(...)` and `Router.redirectPermanentStrict(...)`. The Javadoc of the 301 helpers no longer promises that the method is kept. Issue #1746.
- Misc
- Added conditional writes on the client side: `ClientResource` gets per-call overloads `put`, `patch` and `delete` taking `Conditions`; they apply to that call only and are never retried. `Conditions.unchangedSince(Response)` builds an "If-Match" condition from the strong entity tag that was read, or an "If-Unmodified-Since" condition if the modification date can be deduced to be strong (the response date is at least one second after it, RFC 9110 section 8.8.2.2), and refuses to build an unconditional write otherwise. `Conditions.ifAbsent()` builds "If-None-Match: *" to create a resource only if it does not exist. A failed condition is reported as a 412 `ResourceException`. Issue #100.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
} else if (httpTagCopy.equals("*")) {
result = new Tag("*", weak);
} else {
Context.getCurrentLogger().log(Level.WARNING, "Invalid tag format detected: " + httpTagCopy);

Check warning on line 67 in org.restlet.java/org.restlet/src/main/java/org/restlet/data/Tag.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Format specifiers or lambda should be used instead of string concatenation.

See more on https://sonarcloud.io/project/issues?id=restlet_restlet-framework-java&issues=AaIoSjaOhqSjRnipWieS&open=AaIoSjaOhqSjRnipWieS&pullRequest=1763

Check warning on line 67 in org.restlet.java/org.restlet/src/main/java/org/restlet/data/Tag.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the built-in formatting to construct this argument.

See more on https://sonarcloud.io/project/issues?id=restlet_restlet-framework-java&issues=AaIoSjaOhqSjRnipWieR&open=AaIoSjaOhqSjRnipWieR&pullRequest=1763
}

return result;
Expand All @@ -78,14 +78,21 @@

/**
* Default constructor. The opaque tag is set to null and the weakness indicator
* is set to true.
* is set to true: <b>the tag is weak</b>, see {@link #Tag(String)}.
*/
public Tag() {
this(null, true);
}

/**
* Constructor of weak tags.
* Constructor of weak tags.<br>
* <br>
* Note that RFC 9110 section 8.8.3 defines an entity tag as strong unless it
* carries the "W/" prefix, whereas this constructor creates a <b>weak</b> tag:
* it is written as {@code W/"value"} and never matches an "If-Match" or
* "If-Range" condition (strong comparison). To create a tag that clients can
* use to update or resume a representation, use {@code new Tag(value, false)}.
* Restlet 3.0 creates a strong tag here.
*
* @param opaqueTag The tag value.
*/
Expand Down
Loading