Interface HttpMessageReader<T>
- Type Parameters:
- T- the type of objects in the decoded output stream
- All Known Implementing Classes:
- DecoderHttpMessageReader, DefaultPartHttpMessageReader, FormHttpMessageReader, MultipartHttpMessageReader, PartEventHttpMessageReader, ResourceHttpMessageReader, ServerSentEventHttpMessageReader
public interface HttpMessageReader<T>
Strategy for reading from a 
ReactiveHttpInputMessage and decoding
the stream of bytes to Objects of type <T>.- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Arjen Poutsma, Sebastien Deleuze
- 
Method SummaryModifier and TypeMethodDescriptionbooleancanRead(ResolvableType elementType, @Nullable MediaType mediaType) Whether the given object type is supported by this reader.Return the list of media types supported by this reader.getReadableMediaTypes(ResolvableType elementType) Return the list of media types supported by this Reader for the given type of element.default reactor.core.publisher.Flux<T> read(ResolvableType actualType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) Server-side only alternative toread(ResolvableType, ReactiveHttpInputMessage, Map)with additional context available.reactor.core.publisher.Flux<T> read(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String, Object> hints) Read from the input message and decode to a stream of objects.default reactor.core.publisher.Mono<T> readMono(ResolvableType actualType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) Server-side only alternative toreadMono(ResolvableType, ReactiveHttpInputMessage, Map)with additional, context available.reactor.core.publisher.Mono<T> readMono(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String, Object> hints) Read from the input message and decode to a single object.
- 
Method Details- 
getReadableMediaTypesReturn the list of media types supported by this reader. The list may not apply to every possible target element type and calls to this method should typically be guarded viacanWrite(elementType, null). The list may also exclude media types supported only for a specific element type. Alternatively, usegetReadableMediaTypes(ResolvableType)for a more precise list.- Returns:
- the general list of supported media types
 
- 
getReadableMediaTypesReturn the list of media types supported by this Reader for the given type of element. This list may differ fromgetReadableMediaTypes()if the Reader doesn't support the element type, or if it supports it only for a subset of media types.- Parameters:
- elementType- the type of element to read
- Returns:
- the list of media types supported for the given class
- Since:
- 5.3.4
 
- 
canReadWhether the given object type is supported by this reader.- Parameters:
- elementType- the type of object to check
- mediaType- the media type for the read (possibly- null)
- Returns:
- trueif readable,- falseotherwise
 
- 
readreactor.core.publisher.Flux<T> read(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String, Object> hints) Read from the input message and decode to a stream of objects.- Parameters:
- elementType- the type of objects in the stream which must have been previously checked via- canRead(ResolvableType, MediaType)
- message- the message to read from
- hints- additional information about how to read and decode the input
- Returns:
- the decoded stream of elements
 
- 
readMonoreactor.core.publisher.Mono<T> readMono(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String, Object> hints) Read from the input message and decode to a single object.- Parameters:
- elementType- the type of objects in the stream which must have been previously checked via- canRead(ResolvableType, MediaType)
- message- the message to read from
- hints- additional information about how to read and decode the input
- Returns:
- the decoded object
 
- 
readdefault reactor.core.publisher.Flux<T> read(ResolvableType actualType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) Server-side only alternative toread(ResolvableType, ReactiveHttpInputMessage, Map)with additional context available.- Parameters:
- actualType- the actual type of the target method parameter; for annotated controllers, the- MethodParametercan be accessed via- ResolvableType.getSource().
- elementType- the type of Objects in the output stream
- request- the current request
- response- the current response
- hints- additional information about how to read the body
- Returns:
- the decoded stream of elements
 
- 
readMonodefault reactor.core.publisher.Mono<T> readMono(ResolvableType actualType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) Server-side only alternative toreadMono(ResolvableType, ReactiveHttpInputMessage, Map)with additional, context available.- Parameters:
- actualType- the actual type of the target method parameter; for annotated controllers, the- MethodParametercan be accessed via- ResolvableType.getSource().
- elementType- the type of Objects in the output stream
- request- the current request
- response- the current response
- hints- additional information about how to read the body
- Returns:
- the decoded stream of elements
 
 
-