DefaultServerWebExchange.java (spring-framework-5.3.23) | : | DefaultServerWebExchange.java (spring-framework-5.3.24) | ||
---|---|---|---|---|
skipping to change at line 59 | skipping to change at line 59 | |||
import org.springframework.util.StringUtils; | import org.springframework.util.StringUtils; | |||
import org.springframework.web.server.ServerWebExchange; | import org.springframework.web.server.ServerWebExchange; | |||
import org.springframework.web.server.WebSession; | import org.springframework.web.server.WebSession; | |||
import org.springframework.web.server.i18n.LocaleContextResolver; | import org.springframework.web.server.i18n.LocaleContextResolver; | |||
import org.springframework.web.server.session.WebSessionManager; | import org.springframework.web.server.session.WebSessionManager; | |||
/** | /** | |||
* Default implementation of {@link ServerWebExchange}. | * Default implementation of {@link ServerWebExchange}. | |||
* | * | |||
* @author Rossen Stoyanchev | * @author Rossen Stoyanchev | |||
* @author Brian Clozel | ||||
* @since 5.0 | * @since 5.0 | |||
*/ | */ | |||
public class DefaultServerWebExchange implements ServerWebExchange { | public class DefaultServerWebExchange implements ServerWebExchange { | |||
private static final List<HttpMethod> SAFE_METHODS = Arrays.asList(HttpMe thod.GET, HttpMethod.HEAD); | private static final List<HttpMethod> SAFE_METHODS = Arrays.asList(HttpMe thod.GET, HttpMethod.HEAD); | |||
private static final ResolvableType FORM_DATA_TYPE = | private static final ResolvableType FORM_DATA_TYPE = | |||
ResolvableType.forClassWithGenerics(MultiValueMap.class, String.class, String.class); | ResolvableType.forClassWithGenerics(MultiValueMap.class, String.class, String.class); | |||
private static final ResolvableType MULTIPART_DATA_TYPE = ResolvableType. forClassWithGenerics( | private static final ResolvableType MULTIPART_DATA_TYPE = ResolvableType. forClassWithGenerics( | |||
skipping to change at line 261 | skipping to change at line 262 | |||
return this.notModified; | return this.notModified; | |||
} | } | |||
// Evaluate conditions in order of precedence. | // Evaluate conditions in order of precedence. | |||
// See https://tools.ietf.org/html/rfc7232#section-6 | // See https://tools.ietf.org/html/rfc7232#section-6 | |||
if (validateIfUnmodifiedSince(lastModified)) { | if (validateIfUnmodifiedSince(lastModified)) { | |||
if (this.notModified) { | if (this.notModified) { | |||
getResponse().setStatusCode(HttpStatus.PRECONDITI ON_FAILED); | getResponse().setStatusCode(HttpStatus.PRECONDITI ON_FAILED); | |||
} | } | |||
if (SAFE_METHODS.contains(getRequest().getMethod())) { | ||||
if (StringUtils.hasLength(etag) && getResponseHea | ||||
ders().getETag() == null) { | ||||
getResponseHeaders().setETag(padEtagIfNec | ||||
essary(etag)); | ||||
} | ||||
getResponseHeaders().setLastModified(lastModified | ||||
.toEpochMilli()); | ||||
} | ||||
return this.notModified; | return this.notModified; | |||
} | } | |||
boolean validated = validateIfNoneMatch(etag); | boolean validated = validateIfNoneMatch(etag); | |||
if (!validated) { | if (!validated) { | |||
validateIfModifiedSince(lastModified); | validateIfModifiedSince(lastModified); | |||
} | } | |||
// Update response | // Update response | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 10 lines changed or added |