public class DecoderHttpMessageReader<T> extends java.lang.Object implements HttpMessageReader<T>
HttpMessageReader
that wraps and delegates to a Decoder
.
Also a HttpMessageReader
that pre-resolves decoding hints
from the extra information available on the server side such as the request
or controller method parameter annotations.
Constructor and Description |
---|
DecoderHttpMessageReader(Decoder<T> decoder)
Create an instance wrapping the given
Decoder . |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead(ResolvableType elementType,
MediaType mediaType)
Whether the given object type is supported by this reader.
|
Decoder<T> |
getDecoder()
Return the
Decoder of this reader. |
java.util.List<MediaType> |
getReadableMediaTypes()
Return the
MediaType 's that this reader supports. |
protected java.util.Map<java.lang.String,java.lang.Object> |
getReadHints(ResolvableType actualType,
ResolvableType elementType,
ServerHttpRequest request,
ServerHttpResponse response)
Get additional hints for decoding for example based on the server request
or annotations from controller method parameters.
|
reactor.core.publisher.Flux<T> |
read(ResolvableType elementType,
ReactiveHttpInputMessage message,
java.util.Map<java.lang.String,java.lang.Object> hints)
Read from the input message and encode to a stream of objects.
|
reactor.core.publisher.Flux<T> |
read(ResolvableType actualType,
ResolvableType elementType,
ServerHttpRequest request,
ServerHttpResponse response,
java.util.Map<java.lang.String,java.lang.Object> hints)
Server-side only alternative to
HttpMessageReader.read(ResolvableType, ReactiveHttpInputMessage, Map)
with additional context available. |
reactor.core.publisher.Mono<T> |
readMono(ResolvableType elementType,
ReactiveHttpInputMessage message,
java.util.Map<java.lang.String,java.lang.Object> hints)
Read from the input message and encode to a single object.
|
reactor.core.publisher.Mono<T> |
readMono(ResolvableType actualType,
ResolvableType elementType,
ServerHttpRequest request,
ServerHttpResponse response,
java.util.Map<java.lang.String,java.lang.Object> hints)
Server-side only alternative to
HttpMessageReader.readMono(ResolvableType, ReactiveHttpInputMessage, Map)
with additional, context available. |
public java.util.List<MediaType> getReadableMediaTypes()
HttpMessageReader
MediaType
's that this reader supports.getReadableMediaTypes
in interface HttpMessageReader<T>
public boolean canRead(ResolvableType elementType, @Nullable MediaType mediaType)
HttpMessageReader
canRead
in interface HttpMessageReader<T>
elementType
- the type of object to checkmediaType
- the media type for the read (possibly null
)true
if readable, false
otherwisepublic reactor.core.publisher.Flux<T> read(ResolvableType elementType, ReactiveHttpInputMessage message, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
read
in interface HttpMessageReader<T>
elementType
- the type of objects in the stream which must have been
previously checked via HttpMessageReader.canRead(ResolvableType, MediaType)
message
- the message to read fromhints
- additional information about how to read and decode the inputpublic reactor.core.publisher.Mono<T> readMono(ResolvableType elementType, ReactiveHttpInputMessage message, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
readMono
in interface HttpMessageReader<T>
elementType
- the type of objects in the stream which must have been
previously checked via HttpMessageReader.canRead(ResolvableType, MediaType)
message
- the message to read fromhints
- additional information about how to read and decode the inputpublic reactor.core.publisher.Flux<T> read(ResolvableType actualType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
HttpMessageReader.read(ResolvableType, ReactiveHttpInputMessage, Map)
with additional context available.read
in interface HttpMessageReader<T>
actualType
- the actual type of the target method parameter;
for annotated controllers, the MethodParameter
can be accessed
via ResolvableType.getSource()
.elementType
- the type of Objects in the output streamrequest
- the current requestresponse
- the current responsehints
- additional information about how to read the bodypublic reactor.core.publisher.Mono<T> readMono(ResolvableType actualType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
HttpMessageReader.readMono(ResolvableType, ReactiveHttpInputMessage, Map)
with additional, context available.readMono
in interface HttpMessageReader<T>
actualType
- the actual type of the target method parameter;
for annotated controllers, the MethodParameter
can be accessed
via ResolvableType.getSource()
.elementType
- the type of Objects in the output streamrequest
- the current requestresponse
- the current responsehints
- additional information about how to read the bodyprotected java.util.Map<java.lang.String,java.lang.Object> getReadHints(ResolvableType actualType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response)
HttpMessageDecoder
.