Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish ServletWebRequest #33698

Closed
wants to merge 3 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,23 @@ public boolean checkNotModified(String etag) {

@Override
public boolean checkNotModified(@Nullable String etag, long lastModifiedTimestamp) {
if (this.notModified) {
return true;
}

HttpServletResponse response = getResponse();
if (this.notModified || (response != null && HttpStatus.OK.value() != response.getStatus())) {
return this.notModified;
if (response != null && HttpStatus.OK.value() != response.getStatus()) {
return false;
}

// Evaluate conditions in order of precedence.
// See https://datatracker.ietf.org/doc/html/rfc9110#section-13.2.2
if (validateIfMatch(etag)) {
updateResponseStateChanging(etag, lastModifiedTimestamp);
return this.notModified;
}
// 2) If-Unmodified-Since
else if (validateIfUnmodifiedSince(lastModifiedTimestamp)) {
if (validateIfUnmodifiedSince(lastModifiedTimestamp)) {
updateResponseStateChanging(etag, lastModifiedTimestamp);
return this.notModified;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public interface WebRequest extends RequestAttributes {
* also with conditional POST/PUT/DELETE requests.
* <p><strong>Note:</strong> The HTTP specification recommends
* setting both ETag and Last-Modified values, but you can also
* use {@code #checkNotModified(String)} or
* use {@link #checkNotModified(String)} or
sdeleuze marked this conversation as resolved.
Show resolved Hide resolved
* {@link #checkNotModified(long)}.
* @param etag the entity tag that the application determined
* for the underlying resource. This parameter will be padded
Expand Down