class ReadOnlyHttpHeaders extends HttpHeaders
HttpHeaders
object that can only be read, not written to.Modifier and Type | Field and Description |
---|---|
private java.util.List<MediaType> |
cachedAccept |
private MediaType |
cachedContentType |
private static long |
serialVersionUID |
ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ACCEPT_RANGES, ACCESS_CONTROL_ALLOW_CREDENTIALS, ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ACCESS_CONTROL_EXPOSE_HEADERS, ACCESS_CONTROL_MAX_AGE, ACCESS_CONTROL_REQUEST_HEADERS, ACCESS_CONTROL_REQUEST_METHOD, AGE, ALLOW, AUTHORIZATION, CACHE_CONTROL, CONNECTION, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_RANGE, CONTENT_TYPE, COOKIE, DATE, EMPTY, ETAG, EXPECT, EXPIRES, FROM, headers, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_RANGE, IF_UNMODIFIED_SINCE, LAST_MODIFIED, LINK, LOCATION, MAX_FORWARDS, ORIGIN, PRAGMA, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, RANGE, REFERER, RETRY_AFTER, SERVER, SET_COOKIE, SET_COOKIE2, TE, TRAILER, TRANSFER_ENCODING, UPGRADE, USER_AGENT, VARY, VIA, WARNING, WWW_AUTHENTICATE
Constructor and Description |
---|
ReadOnlyHttpHeaders(HttpHeaders headers) |
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String headerName,
java.lang.String headerValue)
Add the given, single header value under the given name.
|
void |
addAll(MultiValueMap<java.lang.String,java.lang.String> values)
Add all the values of the given
MultiValueMap to the current values. |
void |
addAll(java.lang.String key,
java.util.List<? extends java.lang.String> values)
Add all the values of the given list to the current list of values for the given key.
|
void |
clear() |
java.util.Set<java.util.Map.Entry<java.lang.String,java.util.List<java.lang.String>>> |
entrySet() |
java.util.List<java.lang.String> |
get(java.lang.Object key) |
java.util.List<MediaType> |
getAccept()
Return the list of acceptable media types,
as specified by the
Accept header. |
MediaType |
getContentType()
Return the media type of the body, as specified
by the
Content-Type header. |
java.util.Set<java.lang.String> |
keySet() |
java.util.List<java.lang.String> |
put(java.lang.String key,
java.util.List<java.lang.String> value) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.util.List<java.lang.String>> map) |
java.util.List<java.lang.String> |
remove(java.lang.Object key) |
void |
set(java.lang.String headerName,
java.lang.String headerValue)
Set the given, single header value under the given name.
|
void |
setAll(java.util.Map<java.lang.String,java.lang.String> values)
Set the given values under.
|
java.util.Map<java.lang.String,java.lang.String> |
toSingleValueMap()
Return a
Map with the first values contained in this MultiValueMap . |
java.util.Collection<java.util.List<java.lang.String>> |
values() |
containsKey, containsValue, equals, formatDate, formatHeaders, getAcceptCharset, getAcceptLanguage, getAcceptLanguageAsLocales, getAccessControlAllowCredentials, getAccessControlAllowHeaders, getAccessControlAllowMethods, getAccessControlAllowOrigin, getAccessControlExposeHeaders, getAccessControlMaxAge, getAccessControlRequestHeaders, getAccessControlRequestMethod, getAllow, getCacheControl, getConnection, getContentDisposition, getContentLanguage, getContentLength, getDate, getETag, getETagValuesAsList, getExpires, getFieldValues, getFirst, getFirstDate, getFirstZonedDateTime, getHost, getIfMatch, getIfModifiedSince, getIfNoneMatch, getIfUnmodifiedSince, getLastModified, getLocation, getOrigin, getPragma, getRange, getUpgrade, getValuesAsList, getVary, hashCode, isEmpty, readOnlyHttpHeaders, setAccept, setAcceptCharset, setAcceptLanguage, setAcceptLanguageAsLocales, setAccessControlAllowCredentials, setAccessControlAllowHeaders, setAccessControlAllowMethods, setAccessControlAllowOrigin, setAccessControlExposeHeaders, setAccessControlMaxAge, setAccessControlMaxAge, setAccessControlRequestHeaders, setAccessControlRequestMethod, setAllow, setBasicAuth, setBasicAuth, setBearerAuth, setCacheControl, setCacheControl, setConnection, setConnection, setContentDisposition, setContentDispositionFormData, setContentLanguage, setContentLength, setContentType, setDate, setDate, setDate, setDate, setETag, setExpires, setExpires, setExpires, setHost, setIfMatch, setIfMatch, setIfModifiedSince, setIfModifiedSince, setIfModifiedSince, setIfNoneMatch, setIfNoneMatch, setIfUnmodifiedSince, setIfUnmodifiedSince, setIfUnmodifiedSince, setInstant, setLastModified, setLastModified, setLastModified, setLocation, setOrigin, setPragma, setRange, setUpgrade, setVary, setZonedDateTime, size, toCommaDelimitedString, toString, writableHttpHeaders
private static final long serialVersionUID
ReadOnlyHttpHeaders(HttpHeaders headers)
public MediaType getContentType()
HttpHeaders
Content-Type
header.
Returns null
when the content-type is unknown.
getContentType
in class HttpHeaders
public java.util.List<MediaType> getAccept()
HttpHeaders
Accept
header.
Returns an empty list when the acceptable media types are unspecified.
getAccept
in class HttpHeaders
public java.util.List<java.lang.String> get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
get
in class HttpHeaders
public void add(java.lang.String headerName, @Nullable java.lang.String headerValue)
HttpHeaders
add
in interface MultiValueMap<java.lang.String,java.lang.String>
add
in class HttpHeaders
headerName
- the header nameheaderValue
- the header valueHttpHeaders.put(String, List)
,
HttpHeaders.set(String, String)
public void addAll(java.lang.String key, java.util.List<? extends java.lang.String> values)
MultiValueMap
addAll
in interface MultiValueMap<java.lang.String,java.lang.String>
addAll
in class HttpHeaders
key
- they keyvalues
- the values to be addedpublic void addAll(MultiValueMap<java.lang.String,java.lang.String> values)
MultiValueMap
MultiValueMap
to the current values.addAll
in interface MultiValueMap<java.lang.String,java.lang.String>
addAll
in class HttpHeaders
values
- the values to be addedpublic void set(java.lang.String headerName, @Nullable java.lang.String headerValue)
HttpHeaders
set
in interface MultiValueMap<java.lang.String,java.lang.String>
set
in class HttpHeaders
headerName
- the header nameheaderValue
- the header valueHttpHeaders.put(String, List)
,
HttpHeaders.add(String, String)
public void setAll(java.util.Map<java.lang.String,java.lang.String> values)
MultiValueMap
setAll
in interface MultiValueMap<java.lang.String,java.lang.String>
setAll
in class HttpHeaders
values
- the values.public java.util.Map<java.lang.String,java.lang.String> toSingleValueMap()
MultiValueMap
Map
with the first values contained in this MultiValueMap
.toSingleValueMap
in interface MultiValueMap<java.lang.String,java.lang.String>
toSingleValueMap
in class HttpHeaders
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
keySet
in class HttpHeaders
public java.util.List<java.lang.String> put(java.lang.String key, java.util.List<java.lang.String> value)
put
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
put
in class HttpHeaders
public java.util.List<java.lang.String> remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
remove
in class HttpHeaders
public void putAll(java.util.Map<? extends java.lang.String,? extends java.util.List<java.lang.String>> map)
putAll
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
putAll
in class HttpHeaders
public void clear()
clear
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
clear
in class HttpHeaders
public java.util.Collection<java.util.List<java.lang.String>> values()
values
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
values
in class HttpHeaders
public java.util.Set<java.util.Map.Entry<java.lang.String,java.util.List<java.lang.String>>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
entrySet
in class HttpHeaders