Polishing
This commit is contained in:
parent
b130ff36d9
commit
ca6acfee30
|
@ -19,12 +19,11 @@ package org.springframework.web.context.request;
|
|||
import java.security.Principal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -52,7 +51,7 @@ import org.springframework.web.util.WebUtils;
|
|||
*/
|
||||
public class ServletWebRequest extends ServletRequestAttributes implements NativeWebRequest {
|
||||
|
||||
private static final List<String> SAFE_METHODS = Arrays.asList("GET", "HEAD");
|
||||
private static final Set<String> SAFE_METHODS = Set.of("GET", "HEAD");
|
||||
|
||||
/**
|
||||
* Pattern matching ETag multiple field values in headers such as "If-Match", "If-None-Match".
|
||||
|
|
|
@ -19,9 +19,9 @@ package org.springframework.web.server.adapter;
|
|||
import java.security.Principal;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
@ -62,7 +62,7 @@ import org.springframework.web.server.session.WebSessionManager;
|
|||
*/
|
||||
public class DefaultServerWebExchange implements ServerWebExchange {
|
||||
|
||||
private static final List<HttpMethod> SAFE_METHODS = Arrays.asList(HttpMethod.GET, HttpMethod.HEAD);
|
||||
private static final Set<HttpMethod> SAFE_METHODS = Set.of(HttpMethod.GET, HttpMethod.HEAD);
|
||||
|
||||
private static final ResolvableType FORM_DATA_TYPE =
|
||||
ResolvableType.forClassWithGenerics(MultiValueMap.class, String.class, String.class);
|
||||
|
@ -281,7 +281,7 @@ public class DefaultServerWebExchange implements ServerWebExchange {
|
|||
if (SAFE_METHODS.contains(getRequest().getMethod())) {
|
||||
return false;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(getRequest().getHeaders().get(HttpHeaders.IF_MATCH))) {
|
||||
if (CollectionUtils.isEmpty(getRequestHeaders().get(HttpHeaders.IF_MATCH))) {
|
||||
return false;
|
||||
}
|
||||
this.notModified = matchRequestedETags(getRequestHeaders().getIfMatch(), eTag, false);
|
||||
|
@ -357,7 +357,7 @@ public class DefaultServerWebExchange implements ServerWebExchange {
|
|||
|
||||
private boolean validateIfNoneMatch(@Nullable String eTag) {
|
||||
try {
|
||||
if (CollectionUtils.isEmpty(getRequest().getHeaders().get(HttpHeaders.IF_NONE_MATCH))) {
|
||||
if (CollectionUtils.isEmpty(getRequestHeaders().get(HttpHeaders.IF_NONE_MATCH))) {
|
||||
return false;
|
||||
}
|
||||
this.notModified = !matchRequestedETags(getRequestHeaders().getIfNoneMatch(), eTag, true);
|
||||
|
|
Loading…
Reference in New Issue