| java.lang.Object | |
| ↳ | org.springframework.http.HttpHeaders |
Represents HTTP request and response headers, mapping string header names to list of string values.
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.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new, empty instance of the
HttpHeaders object. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Add the given, single header value under the given name.
| |||||||||||
Return the list of acceptable
media types, as specified by the Accept header. | |||||||||||
Return the list of acceptable
charsets, as specified by the Accept-Charset
header. | |||||||||||
Return the set of allowed
HTTP methods, as specified by the Allow header. | |||||||||||
Returns the value of the
Cache-Control header. | |||||||||||
Return the length of the body in bytes, as specified by the
Content-Length header. | |||||||||||
Return the
media type of the body, as specified by the Content-Type header. | |||||||||||
Returns the date and time at which the message was created, as specified by the
Date header. | |||||||||||
Returns the entity tag of the body, as specified by the
ETag header. | |||||||||||
Returns the date and time at which the message is no longer valid, as specified by the
Expires header. | |||||||||||
Return the first header value for the given header name, if any.
| |||||||||||
Returns the value of the
If-None-Match header. | |||||||||||
Returns the value of the
IfModifiedSince header. | |||||||||||
Returns the time the resource was last changed, as specified by the
Last-Modified header. | |||||||||||
Return the (new) location of a resource, as specified by the
Location header. | |||||||||||
Returns the value of the
Pragma header. | |||||||||||
Returns
HttpHeaders object that can only be read, not written to. | |||||||||||
Set the given, single header value under the given name.
| |||||||||||
Set the list of acceptable
media types, as specified by the Accept header. | |||||||||||
Set the list of acceptable
charsets, as specified by the Accept-Charset header. | |||||||||||
Set the set of allowed
HTTP methods, as specified by the Allow header. | |||||||||||
Sets the (new) value of the
Cache-Control header. | |||||||||||
Sets the (new) value of the
Content-Disposition header for form-data. | |||||||||||
Set the length of the body in bytes, as specified by the
Content-Length header. | |||||||||||
Set the
media type of the body, as specified by the Content-Type header. | |||||||||||
Sets the date and time at which the message was created, as specified by the
Date header. | |||||||||||
Sets the (new) entity tag of the body, as specified by the
ETag header. | |||||||||||
Sets the date and time at which the message is no longer valid, as specified by the
Expires header. | |||||||||||
Sets the (new) value of the
If-Modified-Since header. | |||||||||||
Sets the (new) value of the
If-None-Match header. | |||||||||||
Sets the (new) values of the
If-None-Match header. | |||||||||||
Sets the time the resource was last changed, as specified by the
Last-Modified header. | |||||||||||
Set the (new) location of a resource, as specified by the
Location header. | |||||||||||
Sets the (new) value of the
Pragma header. | |||||||||||
Returns the first values contained in this
MultiValueMap. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.util.Map
| |||||||||||
From interface
org.springframework.util.MultiValueMap
| |||||||||||
Constructs a new, empty instance of the HttpHeaders object.
Add the given, single header value under the given name.
| headerName | the header name |
|---|---|
| headerValue | the header value |
| UnsupportedOperationException | if adding headers is not supported |
|---|
Return the list of acceptable media types, as specified by the Accept header.
Returns an empty list when the acceptable media types are unspecified.
Return the list of acceptable charsets, as specified by the Accept-Charset
header.
Return the set of allowed HTTP methods, as specified by the Allow header.
Returns an empty set when the allowed methods are unspecified.
Returns the value of the Cache-Control header.
Return the length of the body in bytes, as specified by the Content-Length header.
Returns -1 when the content-length is unknown.
Return the media type of the body, as specified by the Content-Type header.
Returns null when the content-type is unknown.
Returns the date and time at which the message was created, as specified by the Date header.
The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
| IllegalArgumentException | if the value can't be converted to a date |
|---|
Returns the entity tag of the body, as specified by the ETag header.
Returns the date and time at which the message is no longer valid, as specified by the Expires header.
The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
Return the first header value for the given header name, if any.
| headerName | the header name |
|---|
null
Returns the value of the If-None-Match header.
Returns the value of the IfModifiedSince header.
The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
Returns the time the resource was last changed, as specified by the Last-Modified header.
The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
Return the (new) location of a resource, as specified by the Location header.
Returns null when the location is unknown.
Returns HttpHeaders object that can only be read, not written to.
Set the given, single header value under the given name.
| headerName | the header name |
|---|---|
| headerValue | the header value |
| UnsupportedOperationException | if adding headers is not supported |
|---|
Set the list of acceptable media types, as specified by the Accept header.
| acceptableMediaTypes | the acceptable media types |
|---|
Set the list of acceptable charsets, as specified by the Accept-Charset header.
| acceptableCharsets | the acceptable charsets |
|---|
Set the set of allowed HTTP methods, as specified by the Allow header.
| allowedMethods | the allowed methods |
|---|
Sets the (new) value of the Cache-Control header.
| cacheControl | the value of the header |
|---|
Sets the (new) value of the Content-Disposition header for form-data.
| name | the control name |
|---|---|
| filename | the filename, may be null
|
Set the length of the body in bytes, as specified by the Content-Length header.
| contentLength | the content length |
|---|
Set the media type of the body, as specified by the Content-Type header.
| mediaType | the media type |
|---|
Sets the date and time at which the message was created, as specified by the Date header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
| date | the date |
|---|
Sets the (new) entity tag of the body, as specified by the ETag header.
| eTag | the new entity tag |
|---|
Sets the date and time at which the message is no longer valid, as specified by the Expires header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
| expires | the new expires header value |
|---|
Sets the (new) value of the If-Modified-Since header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
| ifModifiedSince | the new value of the header |
|---|
Sets the (new) value of the If-None-Match header.
| ifNoneMatch | the new value of the header |
|---|
Sets the (new) values of the If-None-Match header.
| ifNoneMatchList | the new value of the header |
|---|
Sets the time the resource was last changed, as specified by the Last-Modified header.
The date should be specified as the number of milliseconds since January 1, 1970 GMT.
| lastModified | the last modified date |
|---|
Set the (new) location of a resource, as specified by the Location header.
| location | the location |
|---|
Sets the (new) value of the Pragma header.
| pragma | the value of the header |
|---|
Returns the first values contained in this MultiValueMap.