Polishing

This commit is contained in:
Juergen Hoeller
2018-09-17 14:39:54 +02:00
parent 702d533e6f
commit 5ca2c56cf0
10 changed files with 79 additions and 81 deletions
@@ -199,8 +199,8 @@ public class ServerSentEventHttpMessageWriter implements HttpMessageWriter<Objec
@Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {
if (this.encoder instanceof HttpMessageEncoder) {
HttpMessageEncoder<?> httpEncoder = (HttpMessageEncoder<?>) this.encoder;
return httpEncoder.getEncodeHints(actualType, elementType, mediaType, request, response);
HttpMessageEncoder<?> encoder = (HttpMessageEncoder<?>) this.encoder;
return encoder.getEncodeHints(actualType, elementType, mediaType, request, response);
}
return Collections.emptyMap();
}
@@ -1,11 +1,11 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -63,13 +63,13 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
private static final List<String> SAFE_METHODS = Arrays.asList("GET", "HEAD");
/**
* Pattern matching ETag multiple field values in headers such as "If-Match", "If-None-Match"
* Pattern matching ETag multiple field values in headers such as "If-Match", "If-None-Match".
* @see <a href="https://tools.ietf.org/html/rfc7232#section-2.3">Section 2.3 of RFC 7232</a>
*/
private static final Pattern ETAG_HEADER_VALUE_PATTERN = Pattern.compile("\\*|\\s*((W\\/)?(\"[^\"]*\"))\\s*,?");
/**
* Date formats as specified in the HTTP RFC
* Date formats as specified in the HTTP RFC.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.1.1">Section 7.1.1.1 of RFC 7231</a>
*/
private static final String[] DATE_FORMATS = new String[] {
@@ -310,10 +310,10 @@ public class DefaultServerWebExchange implements ServerWebExchange {
}
// We will perform this validation...
etag = padEtagIfNecessary(etag);
for (String clientETag : ifNoneMatch) {
for (String clientEtag : ifNoneMatch) {
// Compare weak/strong ETags as per https://tools.ietf.org/html/rfc7232#section-2.3
if (StringUtils.hasLength(clientETag) &&
clientETag.replaceFirst("^W/", "").equals(etag.replaceFirst("^W/", ""))) {
if (StringUtils.hasLength(clientEtag) &&
clientEtag.replaceFirst("^W/", "").equals(etag.replaceFirst("^W/", ""))) {
this.notModified = true;
break;
}