public class HttpHeaders extends java.lang.Object implements MultiValueMap<java.lang.String,java.lang.String>, java.io.Serializable
In addition to the normal methods defined by Map
, this class offers the following
convenience methods:
getFirst(String)
returns the first value associated with a given header nameadd(String, String)
adds a header value to the list of values for a header nameset(String, String)
sets the header value to a single string valueInspired by com.sun.net.httpserver.Headers
.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACCEPT
The HTTP
Accept header field name. |
static java.lang.String |
ACCEPT_CHARSET
The HTTP
Accept-Charset header field name. |
static java.lang.String |
ACCEPT_ENCODING
The HTTP
Accept-Encoding header field name. |
static java.lang.String |
ACCEPT_LANGUAGE
The HTTP
Accept-Language header field name. |
static java.lang.String |
ACCEPT_RANGES
The HTTP
Accept-Ranges header field name. |
static java.lang.String |
ACCESS_CONTROL_ALLOW_CREDENTIALS
The CORS
Access-Control-Allow-Credentials response header field name. |
static java.lang.String |
ACCESS_CONTROL_ALLOW_HEADERS
The CORS
Access-Control-Allow-Headers response header field name. |
static java.lang.String |
ACCESS_CONTROL_ALLOW_METHODS
The CORS
Access-Control-Allow-Methods response header field name. |
static java.lang.String |
ACCESS_CONTROL_ALLOW_ORIGIN
The CORS
Access-Control-Allow-Origin response header field name. |
static java.lang.String |
ACCESS_CONTROL_EXPOSE_HEADERS
The CORS
Access-Control-Expose-Headers response header field name. |
static java.lang.String |
ACCESS_CONTROL_MAX_AGE
The CORS
Access-Control-Max-Age response header field name. |
static java.lang.String |
ACCESS_CONTROL_REQUEST_HEADERS
The CORS
Access-Control-Request-Headers request header field name. |
static java.lang.String |
ACCESS_CONTROL_REQUEST_METHOD
The CORS
Access-Control-Request-Method request header field name. |
static java.lang.String |
AGE
The HTTP
Age header field name. |
static java.lang.String |
ALLOW
The HTTP
Allow header field name. |
static java.lang.String |
AUTHORIZATION
The HTTP
Authorization header field name. |
static java.lang.String |
CACHE_CONTROL
The HTTP
Cache-Control header field name. |
static java.lang.String |
CONNECTION
The HTTP
Connection header field name. |
static java.lang.String |
CONTENT_DISPOSITION
The HTTP
Content-Disposition header field name |
static java.lang.String |
CONTENT_ENCODING
The HTTP
Content-Encoding header field name. |
static java.lang.String |
CONTENT_LANGUAGE
The HTTP
Content-Language header field name. |
static java.lang.String |
CONTENT_LENGTH
The HTTP
Content-Length header field name. |
static java.lang.String |
CONTENT_LOCATION
The HTTP
Content-Location header field name. |
static java.lang.String |
CONTENT_RANGE
The HTTP
Content-Range header field name. |
static java.lang.String |
CONTENT_TYPE
The HTTP
Content-Type header field name. |
static java.lang.String |
COOKIE
The HTTP
Cookie header field name. |
static java.lang.String |
DATE
The HTTP
Date header field name. |
static java.lang.String |
ETAG
The HTTP
ETag header field name. |
static java.lang.String |
EXPECT
The HTTP
Expect header field name. |
static java.lang.String |
EXPIRES
The HTTP
Expires header field name. |
static java.lang.String |
FROM
The HTTP
From header field name. |
static java.lang.String |
HOST
The HTTP
Host header field name. |
static java.lang.String |
IF_MATCH
The HTTP
If-Match header field name. |
static java.lang.String |
IF_MODIFIED_SINCE
The HTTP
If-Modified-Since header field name. |
static java.lang.String |
IF_NONE_MATCH
The HTTP
If-None-Match header field name. |
static java.lang.String |
IF_RANGE
The HTTP
If-Range header field name. |
static java.lang.String |
IF_UNMODIFIED_SINCE
The HTTP
If-Unmodified-Since header field name. |
static java.lang.String |
LAST_MODIFIED
The HTTP
Last-Modified header field name. |
static java.lang.String |
LINK
The HTTP
Link header field name. |
static java.lang.String |
LOCATION
The HTTP
Location header field name. |
static java.lang.String |
MAX_FORWARDS
The HTTP
Max-Forwards header field name. |
static java.lang.String |
ORIGIN
The HTTP
Origin header field name. |
static java.lang.String |
PRAGMA
The HTTP
Pragma header field name. |
static java.lang.String |
PROXY_AUTHENTICATE
The HTTP
Proxy-Authenticate header field name. |
static java.lang.String |
PROXY_AUTHORIZATION
The HTTP
Proxy-Authorization header field name. |
static java.lang.String |
RANGE
The HTTP
Range header field name. |
static java.lang.String |
REFERER
The HTTP
Referer header field name. |
static java.lang.String |
RETRY_AFTER
The HTTP
Retry-After header field name. |
static java.lang.String |
SERVER
The HTTP
Server header field name. |
static java.lang.String |
SET_COOKIE
The HTTP
Set-Cookie header field name. |
static java.lang.String |
SET_COOKIE2
The HTTP
Set-Cookie2 header field name. |
static java.lang.String |
TE
The HTTP
TE header field name. |
static java.lang.String |
TRAILER
The HTTP
Trailer header field name. |
static java.lang.String |
TRANSFER_ENCODING
The HTTP
Transfer-Encoding header field name. |
static java.lang.String |
UPGRADE
The HTTP
Upgrade header field name. |
static java.lang.String |
USER_AGENT
The HTTP
User-Agent header field name. |
static java.lang.String |
VARY
The HTTP
Vary header field name. |
static java.lang.String |
VIA
The HTTP
Via header field name. |
static java.lang.String |
WARNING
The HTTP
Warning header field name. |
static java.lang.String |
WWW_AUTHENTICATE
The HTTP
WWW-Authenticate header field name. |
Constructor and Description |
---|
HttpHeaders()
Constructs a new, empty instance of the
HttpHeaders object. |
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 |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<java.lang.String,java.util.List<java.lang.String>>> |
entrySet() |
boolean |
equals(java.lang.Object other) |
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. |
java.util.List<java.nio.charset.Charset> |
getAcceptCharset()
Return the list of acceptable charsets,
as specified by the
Accept-Charset header. |
boolean |
getAccessControlAllowCredentials()
Return the value of the
Access-Control-Allow-Credentials response header. |
java.util.List<java.lang.String> |
getAccessControlAllowHeaders()
Return the value of the
Access-Control-Allow-Headers response header. |
java.util.List<HttpMethod> |
getAccessControlAllowMethods()
Return the value of the
Access-Control-Allow-Methods response header. |
java.lang.String |
getAccessControlAllowOrigin()
Return the value of the
Access-Control-Allow-Origin response header. |
java.util.List<java.lang.String> |
getAccessControlExposeHeaders()
Return the value of the
Access-Control-Expose-Headers response header. |
long |
getAccessControlMaxAge()
Return the value of the
Access-Control-Max-Age response header. |
java.util.List<java.lang.String> |
getAccessControlRequestHeaders()
Return the value of the
Access-Control-Request-Headers request header. |
HttpMethod |
getAccessControlRequestMethod()
Return the value of the
Access-Control-Request-Method request header. |
java.util.Set<HttpMethod> |
getAllow()
Return the set of allowed
HTTP methods ,
as specified by the Allow header. |
java.lang.String |
getCacheControl()
Return the value of the
Cache-Control header. |
java.util.List<java.lang.String> |
getConnection()
Return the value of the
Connection header. |
long |
getContentLength()
Return the length of the body in bytes, as specified by the
Content-Length header. |
MediaType |
getContentType()
Return the media type of the body, as specified
by the
Content-Type header. |
long |
getDate()
Return the date and time at which the message was created, as specified
by the
Date header. |
java.lang.String |
getETag()
Return the entity tag of the body, as specified by the
ETag header. |
protected java.util.List<java.lang.String> |
getETagValuesAsList(java.lang.String headerName)
Retrieve a combined result from the field values of the ETag header.
|
long |
getExpires()
Return the date and time at which the message is no longer valid,
as specified by the
Expires header. |
protected java.lang.String |
getFieldValues(java.lang.String headerName)
Retrieve a combined result from the field values of multi-valued headers.
|
java.lang.String |
getFirst(java.lang.String headerName)
Return the first header value for the given header name, if any.
|
long |
getFirstDate(java.lang.String headerName)
Parse the first header value for the given header name as a date,
return -1 if there is no value, or raise
IllegalArgumentException
if the value cannot be parsed as a date. |
java.util.List<java.lang.String> |
getIfMatch()
Return the value of the
If-Match header. |
long |
getIfModifiedSince()
Return the value of the
If-Modified-Since header. |
java.util.List<java.lang.String> |
getIfNoneMatch()
Return the value of the
If-None-Match header. |
long |
getIfUnmodifiedSince()
Return the value of the
If-Unmodified-Since header. |
long |
getLastModified()
Return the time the resource was last changed, as specified by the
Last-Modified header. |
java.net.URI |
getLocation()
Return the (new) location of a resource
as specified by the
Location header. |
java.lang.String |
getOrigin()
Return the value of the
Origin header. |
java.lang.String |
getPragma()
Return the value of the
Pragma header. |
java.util.List<HttpRange> |
getRange()
Return the value of the
Range header. |
java.lang.String |
getUpgrade()
Return the value of the
Upgrade header. |
java.util.List<java.lang.String> |
getValuesAsList(java.lang.String headerName)
Return all values of a given header name,
even if this header is set multiple times.
|
java.util.List<java.lang.String> |
getVary()
Return the request header names subject to content negotiation.
|
int |
hashCode() |
boolean |
isEmpty() |
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) |
static HttpHeaders |
readOnlyHttpHeaders(HttpHeaders headers)
Return a
HttpHeaders object that can only be read, not written to. |
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 |
setAccept(java.util.List<MediaType> acceptableMediaTypes)
Set the list of acceptable media types,
as specified by the
Accept header. |
void |
setAcceptCharset(java.util.List<java.nio.charset.Charset> acceptableCharsets)
Set the list of acceptable charsets,
as specified by the
Accept-Charset header. |
void |
setAccessControlAllowCredentials(boolean allowCredentials)
Set the (new) value of the
Access-Control-Allow-Credentials response header. |
void |
setAccessControlAllowHeaders(java.util.List<java.lang.String> allowedHeaders)
Set the (new) value of the
Access-Control-Allow-Headers response header. |
void |
setAccessControlAllowMethods(java.util.List<HttpMethod> allowedMethods)
Set the (new) value of the
Access-Control-Allow-Methods response header. |
void |
setAccessControlAllowOrigin(java.lang.String allowedOrigin)
Set the (new) value of the
Access-Control-Allow-Origin response header. |
void |
setAccessControlExposeHeaders(java.util.List<java.lang.String> exposedHeaders)
Set the (new) value of the
Access-Control-Expose-Headers response header. |
void |
setAccessControlMaxAge(long maxAge)
Set the (new) value of the
Access-Control-Max-Age response header. |
void |
setAccessControlRequestHeaders(java.util.List<java.lang.String> requestHeaders)
Set the (new) value of the
Access-Control-Request-Headers request header. |
void |
setAccessControlRequestMethod(HttpMethod requestMethod)
Set the (new) value of the
Access-Control-Request-Method request header. |
void |
setAll(java.util.Map<java.lang.String,java.lang.String> values)
Set the given values under.
|
void |
setAllow(java.util.Set<HttpMethod> allowedMethods)
Set the set of allowed
HTTP methods ,
as specified by the Allow header. |
void |
setCacheControl(java.lang.String cacheControl)
Set the (new) value of the
Cache-Control header. |
void |
setConnection(java.util.List<java.lang.String> connection)
Set the (new) value of the
Connection header. |
void |
setConnection(java.lang.String connection)
Set the (new) value of the
Connection header. |
void |
setContentDispositionFormData(java.lang.String name,
java.lang.String filename)
Set the
Content-Disposition header when creating a
"multipart/form-data" request. |
void |
setContentDispositionFormData(java.lang.String name,
java.lang.String filename,
java.nio.charset.Charset charset)
Deprecated.
deprecated in 4.3.11 and removed from 5.0; as per
RFC 7578, Section 4.2,
an RFC 5987 style encoding should not be used for multipart/form-data requests.
Furthermore there should be no reason for applications to set this header
explicitly; for more details also read
setContentDispositionFormData(String, String) |
void |
setContentLength(long contentLength)
Set the length of the body in bytes, as specified by the
Content-Length header. |
void |
setContentType(MediaType mediaType)
Set the media type of the body,
as specified by the
Content-Type header. |
void |
setDate(long date)
Set the date and time at which the message was created, as specified
by the
Date header. |
void |
setDate(java.lang.String headerName,
long date)
Set the given date under the given header name after formatting it as a string
using the pattern
"EEE, dd MMM yyyy HH:mm:ss zzz" . |
void |
setETag(java.lang.String etag)
Set the (new) entity tag of the body, as specified by the
ETag header. |
void |
setExpires(long expires)
Set the date and time at which the message is no longer valid,
as specified by the
Expires header. |
void |
setIfMatch(java.util.List<java.lang.String> ifMatchList)
Set the (new) value of the
If-Match header. |
void |
setIfMatch(java.lang.String ifMatch)
Set the (new) value of the
If-Match header. |
void |
setIfModifiedSince(long ifModifiedSince)
Set the (new) value of the
If-Modified-Since header. |
void |
setIfNoneMatch(java.util.List<java.lang.String> ifNoneMatchList)
Set the (new) values of the
If-None-Match header. |
void |
setIfNoneMatch(java.lang.String ifNoneMatch)
Set the (new) value of the
If-None-Match header. |
void |
setIfUnmodifiedSince(long ifUnmodifiedSince)
Set the (new) value of the
If-Unmodified-Since header. |
void |
setLastModified(long lastModified)
Set the time the resource was last changed, as specified by the
Last-Modified header. |
void |
setLocation(java.net.URI location)
Set the (new) location of a resource,
as specified by the
Location header. |
void |
setOrigin(java.lang.String origin)
Set the (new) value of the
Origin header. |
void |
setPragma(java.lang.String pragma)
Set the (new) value of the
Pragma header. |
void |
setRange(java.util.List<HttpRange> ranges)
Sets the (new) value of the
Range header. |
void |
setUpgrade(java.lang.String upgrade)
Set the (new) value of the
Upgrade header. |
void |
setVary(java.util.List<java.lang.String> requestHeaders)
Set the request header names (e.g.
|
int |
size() |
protected java.lang.String |
toCommaDelimitedString(java.util.List<java.lang.String> headerValues)
Turn the given list of header values into a comma-delimited result.
|
java.util.Map<java.lang.String,java.lang.String> |
toSingleValueMap()
Returns the first values contained in this
MultiValueMap . |
java.lang.String |
toString() |
java.util.Collection<java.util.List<java.lang.String>> |
values() |
public static final java.lang.String ACCEPT
Accept
header field name.public static final java.lang.String ACCEPT_CHARSET
Accept-Charset
header field name.public static final java.lang.String ACCEPT_ENCODING
Accept-Encoding
header field name.public static final java.lang.String ACCEPT_LANGUAGE
Accept-Language
header field name.public static final java.lang.String ACCEPT_RANGES
Accept-Ranges
header field name.public static final java.lang.String ACCESS_CONTROL_ALLOW_CREDENTIALS
Access-Control-Allow-Credentials
response header field name.public static final java.lang.String ACCESS_CONTROL_ALLOW_HEADERS
Access-Control-Allow-Headers
response header field name.public static final java.lang.String ACCESS_CONTROL_ALLOW_METHODS
Access-Control-Allow-Methods
response header field name.public static final java.lang.String ACCESS_CONTROL_ALLOW_ORIGIN
Access-Control-Allow-Origin
response header field name.public static final java.lang.String ACCESS_CONTROL_EXPOSE_HEADERS
Access-Control-Expose-Headers
response header field name.public static final java.lang.String ACCESS_CONTROL_MAX_AGE
Access-Control-Max-Age
response header field name.public static final java.lang.String ACCESS_CONTROL_REQUEST_HEADERS
Access-Control-Request-Headers
request header field name.public static final java.lang.String ACCESS_CONTROL_REQUEST_METHOD
Access-Control-Request-Method
request header field name.public static final java.lang.String AGE
Age
header field name.public static final java.lang.String ALLOW
Allow
header field name.public static final java.lang.String AUTHORIZATION
Authorization
header field name.public static final java.lang.String CACHE_CONTROL
Cache-Control
header field name.public static final java.lang.String CONNECTION
Connection
header field name.public static final java.lang.String CONTENT_ENCODING
Content-Encoding
header field name.public static final java.lang.String CONTENT_DISPOSITION
Content-Disposition
header field namepublic static final java.lang.String CONTENT_LANGUAGE
Content-Language
header field name.public static final java.lang.String CONTENT_LENGTH
Content-Length
header field name.public static final java.lang.String CONTENT_LOCATION
Content-Location
header field name.public static final java.lang.String CONTENT_RANGE
Content-Range
header field name.public static final java.lang.String CONTENT_TYPE
Content-Type
header field name.public static final java.lang.String COOKIE
Cookie
header field name.public static final java.lang.String DATE
Date
header field name.public static final java.lang.String ETAG
ETag
header field name.public static final java.lang.String EXPECT
Expect
header field name.public static final java.lang.String EXPIRES
Expires
header field name.public static final java.lang.String FROM
From
header field name.public static final java.lang.String HOST
Host
header field name.public static final java.lang.String IF_MATCH
If-Match
header field name.public static final java.lang.String IF_MODIFIED_SINCE
If-Modified-Since
header field name.public static final java.lang.String IF_NONE_MATCH
If-None-Match
header field name.public static final java.lang.String IF_RANGE
If-Range
header field name.public static final java.lang.String IF_UNMODIFIED_SINCE
If-Unmodified-Since
header field name.public static final java.lang.String LAST_MODIFIED
Last-Modified
header field name.public static final java.lang.String LINK
Link
header field name.public static final java.lang.String LOCATION
Location
header field name.public static final java.lang.String MAX_FORWARDS
Max-Forwards
header field name.public static final java.lang.String ORIGIN
Origin
header field name.public static final java.lang.String PRAGMA
Pragma
header field name.public static final java.lang.String PROXY_AUTHENTICATE
Proxy-Authenticate
header field name.public static final java.lang.String PROXY_AUTHORIZATION
Proxy-Authorization
header field name.public static final java.lang.String RANGE
Range
header field name.public static final java.lang.String REFERER
Referer
header field name.public static final java.lang.String RETRY_AFTER
Retry-After
header field name.public static final java.lang.String SERVER
Server
header field name.public static final java.lang.String SET_COOKIE
Set-Cookie
header field name.public static final java.lang.String SET_COOKIE2
Set-Cookie2
header field name.public static final java.lang.String TE
TE
header field name.public static final java.lang.String TRAILER
Trailer
header field name.public static final java.lang.String TRANSFER_ENCODING
Transfer-Encoding
header field name.public static final java.lang.String UPGRADE
Upgrade
header field name.public static final java.lang.String USER_AGENT
User-Agent
header field name.public static final java.lang.String VARY
Vary
header field name.public static final java.lang.String VIA
Via
header field name.public static final java.lang.String WARNING
Warning
header field name.public static final java.lang.String WWW_AUTHENTICATE
WWW-Authenticate
header field name.public HttpHeaders()
HttpHeaders
object.public void setAccept(java.util.List<MediaType> acceptableMediaTypes)
Accept
header.public java.util.List<MediaType> getAccept()
Accept
header.
Returns an empty list when the acceptable media types are unspecified.
public void setAccessControlAllowCredentials(boolean allowCredentials)
Access-Control-Allow-Credentials
response header.public boolean getAccessControlAllowCredentials()
Access-Control-Allow-Credentials
response header.public void setAccessControlAllowHeaders(java.util.List<java.lang.String> allowedHeaders)
Access-Control-Allow-Headers
response header.public java.util.List<java.lang.String> getAccessControlAllowHeaders()
Access-Control-Allow-Headers
response header.public void setAccessControlAllowMethods(java.util.List<HttpMethod> allowedMethods)
Access-Control-Allow-Methods
response header.public java.util.List<HttpMethod> getAccessControlAllowMethods()
Access-Control-Allow-Methods
response header.public void setAccessControlAllowOrigin(java.lang.String allowedOrigin)
Access-Control-Allow-Origin
response header.public java.lang.String getAccessControlAllowOrigin()
Access-Control-Allow-Origin
response header.public void setAccessControlExposeHeaders(java.util.List<java.lang.String> exposedHeaders)
Access-Control-Expose-Headers
response header.public java.util.List<java.lang.String> getAccessControlExposeHeaders()
Access-Control-Expose-Headers
response header.public void setAccessControlMaxAge(long maxAge)
Access-Control-Max-Age
response header.public long getAccessControlMaxAge()
Access-Control-Max-Age
response header.
Returns -1 when the max age is unknown.
public void setAccessControlRequestHeaders(java.util.List<java.lang.String> requestHeaders)
Access-Control-Request-Headers
request header.public java.util.List<java.lang.String> getAccessControlRequestHeaders()
Access-Control-Request-Headers
request header.public void setAccessControlRequestMethod(HttpMethod requestMethod)
Access-Control-Request-Method
request header.public HttpMethod getAccessControlRequestMethod()
Access-Control-Request-Method
request header.public void setAcceptCharset(java.util.List<java.nio.charset.Charset> acceptableCharsets)
Accept-Charset
header.public java.util.List<java.nio.charset.Charset> getAcceptCharset()
Accept-Charset
header.public void setAllow(java.util.Set<HttpMethod> allowedMethods)
HTTP methods
,
as specified by the Allow
header.public java.util.Set<HttpMethod> getAllow()
HTTP methods
,
as specified by the Allow
header.
Returns an empty set when the allowed methods are unspecified.
public void setCacheControl(java.lang.String cacheControl)
Cache-Control
header.public java.lang.String getCacheControl()
Cache-Control
header.public void setConnection(java.lang.String connection)
Connection
header.public void setConnection(java.util.List<java.lang.String> connection)
Connection
header.public java.util.List<java.lang.String> getConnection()
Connection
header.public void setContentDispositionFormData(java.lang.String name, java.lang.String filename)
Content-Disposition
header when creating a
"multipart/form-data"
request.
Applications typically would not set this header directly but
rather prepare a MultiValueMap<String, Object>
, containing an
Object or a Resource
for each part,
and then pass that to the RestTemplate
or WebClient
.
name
- the control namefilename
- the filename (may be null
)@Deprecated public void setContentDispositionFormData(java.lang.String name, java.lang.String filename, java.nio.charset.Charset charset)
setContentDispositionFormData(String, String)
Content-Disposition
header
for form-data
, optionally encoding the filename using the RFC 5987.
Only the US-ASCII, UTF-8 and ISO-8859-1 charsets are supported.
name
- the control namefilename
- the filename (may be null
)charset
- the charset used for the filename (may be null
)public void setContentLength(long contentLength)
Content-Length
header.public long getContentLength()
Content-Length
header.
Returns -1 when the content-length is unknown.
public void setContentType(MediaType mediaType)
Content-Type
header.public MediaType getContentType()
Content-Type
header.
Returns null
when the content-type is unknown.
public void setDate(long date)
Date
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
public long getDate()
Date
header.
The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
java.lang.IllegalArgumentException
- if the value cannot be converted to a datepublic void setETag(java.lang.String etag)
ETag
header.public java.lang.String getETag()
ETag
header.public void setExpires(long expires)
Expires
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
public long getExpires()
Expires
header.
The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
public void setIfMatch(java.lang.String ifMatch)
If-Match
header.public void setIfMatch(java.util.List<java.lang.String> ifMatchList)
If-Match
header.public java.util.List<java.lang.String> getIfMatch()
If-Match
header.public void setIfModifiedSince(long ifModifiedSince)
If-Modified-Since
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
public long getIfModifiedSince()
If-Modified-Since
header.
The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
public void setIfNoneMatch(java.lang.String ifNoneMatch)
If-None-Match
header.public void setIfNoneMatch(java.util.List<java.lang.String> ifNoneMatchList)
If-None-Match
header.public java.util.List<java.lang.String> getIfNoneMatch()
If-None-Match
header.public void setIfUnmodifiedSince(long ifUnmodifiedSince)
If-Unmodified-Since
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
public long getIfUnmodifiedSince()
If-Unmodified-Since
header.
The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
public void setLastModified(long lastModified)
Last-Modified
header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
public long getLastModified()
Last-Modified
header.
The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
public void setLocation(java.net.URI location)
Location
header.public java.net.URI getLocation()
Location
header.
Returns null
when the location is unknown.
public void setOrigin(java.lang.String origin)
Origin
header.public java.lang.String getOrigin()
Origin
header.public void setPragma(java.lang.String pragma)
Pragma
header.public java.lang.String getPragma()
Pragma
header.public void setRange(java.util.List<HttpRange> ranges)
Range
header.public java.util.List<HttpRange> getRange()
Range
header.
Returns an empty list when the range is unknown.
public void setUpgrade(java.lang.String upgrade)
Upgrade
header.public java.lang.String getUpgrade()
Upgrade
header.public void setVary(java.util.List<java.lang.String> requestHeaders)
requestHeaders
- the request header namespublic java.util.List<java.lang.String> getVary()
public void setDate(java.lang.String headerName, long date)
"EEE, dd MMM yyyy HH:mm:ss zzz"
. The equivalent of
set(String, String)
but for date headers.public long getFirstDate(java.lang.String headerName)
IllegalArgumentException
if the value cannot be parsed as a date.headerName
- the header namepublic java.util.List<java.lang.String> getValuesAsList(java.lang.String headerName)
headerName
- the header nameprotected java.util.List<java.lang.String> getETagValuesAsList(java.lang.String headerName)
headerName
- the header nameprotected java.lang.String getFieldValues(java.lang.String headerName)
headerName
- the header nameprotected java.lang.String toCommaDelimitedString(java.util.List<java.lang.String> headerValues)
headerValues
- the list of header valuespublic java.lang.String getFirst(java.lang.String headerName)
getFirst
in interface MultiValueMap<java.lang.String,java.lang.String>
headerName
- the header namenull
if nonepublic void add(java.lang.String headerName, java.lang.String headerValue)
add
in interface MultiValueMap<java.lang.String,java.lang.String>
headerName
- the header nameheaderValue
- the header valuejava.lang.UnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
set(String, String)
public void set(java.lang.String headerName, java.lang.String headerValue)
set
in interface MultiValueMap<java.lang.String,java.lang.String>
headerName
- the header nameheaderValue
- the header valuejava.lang.UnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
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>
values
- the values.public java.util.Map<java.lang.String,java.lang.String> toSingleValueMap()
MultiValueMap
MultiValueMap
.toSingleValueMap
in interface MultiValueMap<java.lang.String,java.lang.String>
public int size()
size
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
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>>
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>>
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>>
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>>
public void clear()
clear
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
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>>
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>>
public boolean equals(java.lang.Object other)
equals
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static HttpHeaders readOnlyHttpHeaders(HttpHeaders headers)
HttpHeaders
object that can only be read, not written to.