Merge branch '5.1.x'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -40,10 +40,15 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
|
||||
@Nullable
|
||||
private MediaType cachedContentType;
|
||||
|
||||
@Nullable
|
||||
private List<MediaType> cachedAccept;
|
||||
|
||||
|
||||
ReadOnlyHttpHeaders(HttpHeaders headers) {
|
||||
super(headers.headers);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MediaType getContentType() {
|
||||
if (this.cachedContentType != null) {
|
||||
@@ -56,6 +61,18 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MediaType> getAccept() {
|
||||
if (this.cachedAccept != null) {
|
||||
return this.cachedAccept;
|
||||
}
|
||||
else {
|
||||
List<MediaType> accept = super.getAccept();
|
||||
this.cachedAccept = accept;
|
||||
return accept;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> get(Object key) {
|
||||
List<String> values = this.headers.get(key);
|
||||
|
||||
Reference in New Issue
Block a user