mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 05:49:04 +00:00
Polishing
This commit is contained in:
@@ -468,9 +468,9 @@ public class HttpHeaders implements Serializable {
|
||||
* <p>If the supplied {@code HttpHeaders} instance is a
|
||||
* {@linkplain #readOnlyHttpHeaders(HttpHeaders) read-only}
|
||||
* {@code HttpHeaders} wrapper, it will be unwrapped to ensure that the
|
||||
* {@code HttpHeaders} instance created by this constructor is mutable.
|
||||
* Once the writable instance is mutated, the read-only instance is
|
||||
* likely to be out of sync and should be discarded.
|
||||
* {@code HttpHeaders} instance created by this constructor is mutable. Once
|
||||
* the writable instance is mutated, the read-only instance is likely to be
|
||||
* out of sync and should be discarded.
|
||||
* @param httpHeaders the headers to expose
|
||||
* @since 7.0
|
||||
* @see #copyOf(HttpHeaders)
|
||||
|
||||
@@ -32,9 +32,10 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
/**
|
||||
* {@code HttpHeaders} object that can only be read, not written to.
|
||||
* <p>This caches the parsed representations of the "Accept" and "Content-Type" headers
|
||||
* and will get out of sync with the backing map it is mutated at runtime.
|
||||
* {@code HttpHeaders} variant that can only be read, not written to.
|
||||
*
|
||||
* <p>This caches the parsed representations of the "Accept" and "Content-Type"
|
||||
* headers and will get out of sync with the backing map if it is mutated at runtime.
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @author Sam Brannen
|
||||
@@ -44,11 +45,13 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
|
||||
|
||||
private static final long serialVersionUID = -8578554704772377436L;
|
||||
|
||||
|
||||
private @Nullable MediaType cachedContentType;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private @Nullable List<MediaType> cachedAccept;
|
||||
|
||||
|
||||
ReadOnlyHttpHeaders(MultiValueMap<String, String> headers) {
|
||||
super(headers);
|
||||
}
|
||||
@@ -138,7 +141,6 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
|
||||
return Collections.unmodifiableSet(super.headerNames());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> put(String key, List<String> value) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
Reference in New Issue
Block a user