Package org.springframework.http
Interface RequestEntity.HeadersBuilder<B extends RequestEntity.HeadersBuilder<B>>
- Type Parameters:
B
- the builder subclass
- All Known Subinterfaces:
RequestEntity.BodyBuilder
- Enclosing class:
- RequestEntity<T>
public static interface RequestEntity.HeadersBuilder<B extends RequestEntity.HeadersBuilder<B>>
Defines a builder that adds headers to the request entity.
-
Method Summary
Modifier and TypeMethodDescriptionSet the list of acceptable media types, as specified by theAccept
header.acceptCharset
(Charset... acceptableCharsets) Set the list of acceptable charsets, as specified by theAccept-Charset
header.build()
Builds the request entity with no body.Add the given, single header value under the given name.headers
(@Nullable HttpHeaders headers) Copy the given headers into the entity's headers map.headers
(Consumer<HttpHeaders> headersConsumer) Manipulate this entity's headers with the given consumer.ifModifiedSince
(long ifModifiedSince) Set the value of theIf-Modified-Since
header.ifModifiedSince
(Instant ifModifiedSince) Set the value of theIf-Modified-Since
header.ifModifiedSince
(ZonedDateTime ifModifiedSince) Set the value of theIf-Modified-Since
header.ifNoneMatch
(String... ifNoneMatches) Set the values of theIf-None-Match
header.
-
Method Details
-
header
Add the given, single header value under the given name.- Parameters:
headerName
- the header nameheaderValues
- the header value(s)- Returns:
- this builder
- See Also:
-
headers
Copy the given headers into the entity's headers map.- Parameters:
headers
- the existing HttpHeaders to copy from- Returns:
- this builder
- Since:
- 5.2
- See Also:
-
headers
Manipulate this entity's headers with the given consumer. The headers provided to the consumer are "live", so that the consumer can be used to overwrite existing header values, remove values, or use any of the otherHttpHeaders
methods.- Parameters:
headersConsumer
- a function that consumes theHttpHeaders
- Returns:
- this builder
- Since:
- 5.2
-
accept
Set the list of acceptable media types, as specified by theAccept
header.- Parameters:
acceptableMediaTypes
- the acceptable media types
-
acceptCharset
Set the list of acceptable charsets, as specified by theAccept-Charset
header.- Parameters:
acceptableCharsets
- the acceptable charsets
-
ifModifiedSince
Set the value of theIf-Modified-Since
header.- Parameters:
ifModifiedSince
- the new value of the header- Since:
- 5.1.4
-
ifModifiedSince
Set the value of theIf-Modified-Since
header.- Parameters:
ifModifiedSince
- the new value of the header- Since:
- 5.1.4
-
ifModifiedSince
Set the value of theIf-Modified-Since
header.The date should be specified as the number of milliseconds since January 1, 1970 GMT.
- Parameters:
ifModifiedSince
- the new value of the header
-
ifNoneMatch
Set the values of theIf-None-Match
header.- Parameters:
ifNoneMatches
- the new value of the header
-
build
RequestEntity<Void> build()Builds the request entity with no body.- Returns:
- the request entity
- See Also:
-