Class ClientResponseWrapper.HeadersWrapper
- java.lang.Object
- org.springframework.web.reactive.function.client.support.ClientResponseWrapper.HeadersWrapper
- All Implemented Interfaces:
ClientResponse.Headers
- Enclosing class:
- ClientResponseWrapper
public static class ClientResponseWrapper.HeadersWrapper extends Object implements ClientResponse.Headers
Implementation of theHeaders
interface that can be subclassed to adapt the headers in aexchange filter function
. All methods default to calling through to the wrapped request.
Constructor Summary
Constructors Constructor Description HeadersWrapper(ClientResponse.Headers headers)
Create a newHeadersWrapper
that wraps the given request.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpHeaders
asHttpHeaders()
Return the headers as anHttpHeaders
instance.OptionalLong
contentLength()
Return the length of the body in bytes, as specified by theContent-Length
header.Optional<MediaType>
contentType()
Return the media type of the body, as specified by theContent-Type
header.List<String>
header(String headerName)
Return the header value(s), if any, for the header of the given name.
Constructor Detail
HeadersWrapper
public HeadersWrapper(ClientResponse.Headers headers)
Create a newHeadersWrapper
that wraps the given request.- Parameters:
headers
- the headers to wrap
Method Detail
contentLength
public OptionalLong contentLength()
Description copied from interface:ClientResponse.Headers
Return the length of the body in bytes, as specified by theContent-Length
header.- Specified by:
contentLength
in interfaceClientResponse.Headers
contentType
public Optional<MediaType> contentType()
Description copied from interface:ClientResponse.Headers
Return the media type of the body, as specified by theContent-Type
header.- Specified by:
contentType
in interfaceClientResponse.Headers
header
public List<String> header(String headerName)
Description copied from interface:ClientResponse.Headers
Return the header value(s), if any, for the header of the given name.Return an empty list if no header values are found.
- Specified by:
header
in interfaceClientResponse.Headers
- Parameters:
headerName
- the header name
asHttpHeaders
public HttpHeaders asHttpHeaders()
Description copied from interface:ClientResponse.Headers
Return the headers as anHttpHeaders
instance.- Specified by:
asHttpHeaders
in interfaceClientResponse.Headers