Polishing
This commit is contained in:
@@ -19,7 +19,6 @@ package org.springframework.web.reactive.function.server;
|
||||
import java.net.URI;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -159,8 +158,7 @@ class DefaultEntityResponseBuilder<T> implements EntityResponse.Builder<T> {
|
||||
@Override
|
||||
public EntityResponse.Builder<T> lastModified(ZonedDateTime lastModified) {
|
||||
ZonedDateTime gmt = lastModified.withZoneSameInstant(ZoneId.of("GMT"));
|
||||
String headerValue = DateTimeFormatter.RFC_1123_DATE_TIME.format(gmt);
|
||||
this.headers.set(HttpHeaders.LAST_MODIFIED, headerValue);
|
||||
this.headers.setZonedDateTime(HttpHeaders.LAST_MODIFIED, gmt);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,6 +272,9 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Abstract base class for {@link ServerResponse} implementations.
|
||||
*/
|
||||
abstract static class AbstractServerResponse implements ServerResponse {
|
||||
|
||||
private static final Set<HttpMethod> SAFE_METHODS = EnumSet.of(HttpMethod.GET, HttpMethod.HEAD);
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.web.reactive.function.BodyInserters;
|
||||
* @author Arjen Poutsma
|
||||
* @author Juergen Hoeller
|
||||
* @since 5.0
|
||||
* @param <T> the entity type
|
||||
*/
|
||||
public interface EntityResponse<T> extends ServerResponse {
|
||||
|
||||
@@ -100,6 +101,8 @@ public interface EntityResponse<T> extends ServerResponse {
|
||||
|
||||
/**
|
||||
* Defines a builder for {@code EntityResponse}.
|
||||
*
|
||||
* @param <T> a self reference to the builder type
|
||||
*/
|
||||
interface Builder<T> {
|
||||
|
||||
@@ -173,11 +176,11 @@ public interface EntityResponse<T> extends ServerResponse {
|
||||
|
||||
/**
|
||||
* Set the entity tag of the body, as specified by the {@code ETag} header.
|
||||
* @param eTag the new entity tag
|
||||
* @param etag the new entity tag
|
||||
* @return this builder
|
||||
* @see HttpHeaders#setETag(String)
|
||||
*/
|
||||
Builder<T> eTag(String eTag);
|
||||
Builder<T> eTag(String etag);
|
||||
|
||||
/**
|
||||
* Set the time the resource was last changed, as specified by the
|
||||
|
||||
@@ -412,9 +412,9 @@ public interface ServerResponse {
|
||||
* Render the template with the given {@code name} using the given {@code modelAttributes}.
|
||||
* The model attributes are mapped under a
|
||||
* {@linkplain org.springframework.core.Conventions#getVariableName generated name}.
|
||||
* <p><emphasis>Note: Empty {@link Collection Collections} are not added to
|
||||
* <p><em>Note: Empty {@link Collection Collections} are not added to
|
||||
* the model when using this method because we cannot correctly determine
|
||||
* the true convention name.</emphasis>
|
||||
* the true convention name.</em>
|
||||
* @param name the name of the template to be rendered
|
||||
* @param modelAttributes the modelAttributes used to render the template
|
||||
* @return the built response
|
||||
|
||||
Reference in New Issue
Block a user