public abstract class AbstractServerHttpMessageReader<T> extends java.lang.Object implements ServerHttpMessageReader<T>
HttpMessageReader
wrapper that implements ServerHttpMessageReader
in order
to allow providing hints to the nested reader
or setting the response status for
example, by implementing resolveReadHints(ResolvableType, ResolvableType, ServerHttpRequest)
.Modifier and Type | Field and Description |
---|---|
private HttpMessageReader<T> |
reader |
Constructor and Description |
---|
AbstractServerHttpMessageReader(HttpMessageReader<T> reader) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead(ResolvableType elementType,
MediaType mediaType)
Indicates whether the given class can be read by this converter.
|
java.util.List<MediaType> |
getReadableMediaTypes()
Return the list of
MediaType objects that can be read by this converter. |
<any> |
read(ResolvableType elementType,
ReactiveHttpInputMessage inputMessage,
java.util.Map<java.lang.String,java.lang.Object> hints)
Read a
Flux of the given type form the given input message, and returns it. |
<any> |
read(ResolvableType streamType,
ResolvableType elementType,
ServerHttpRequest request,
ServerHttpResponse response,
java.util.Map<java.lang.String,java.lang.Object> hints)
Read a
Flux of the given type form the given input message with additional server related
parameters which could be used to create some hints or set the response status for example. |
<any> |
readMono(ResolvableType elementType,
ReactiveHttpInputMessage inputMessage,
java.util.Map<java.lang.String,java.lang.Object> hints)
Read a
Mono of the given type form the given input message, and returns it. |
<any> |
readMono(ResolvableType streamType,
ResolvableType elementType,
ServerHttpRequest request,
ServerHttpResponse response,
java.util.Map<java.lang.String,java.lang.Object> hints)
Read a
Mono of the given type form the given input message with additional server related
parameters which could be used to create some hints or set the response status for example. |
protected abstract java.util.Map<java.lang.String,java.lang.Object> |
resolveReadHints(ResolvableType streamType,
ResolvableType elementType,
ServerHttpRequest request)
Invoked before reading the request to resolve hints by
read(ResolvableType, ResolvableType, ServerHttpRequest, ServerHttpResponse, Map) . |
private HttpMessageReader<T> reader
public AbstractServerHttpMessageReader(HttpMessageReader<T> reader)
public boolean canRead(ResolvableType elementType, MediaType mediaType)
HttpMessageReader
canRead
in interface HttpMessageReader<T>
elementType
- the stream element type to test for readabilitymediaType
- the media type to read, can be null
if not specified.
Typically the value of a Content-Type
header.true
if readable; false
otherwisepublic <any> read(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
Flux
of the given type form the given input message, and returns it.read
in interface HttpMessageReader<T>
elementType
- the stream element type to return. This type must have previously been
passed to the canRead
method of this interface, which must have
returned true
.inputMessage
- the HTTP input message to read fromhints
- additional information about how to read the bodyFlux
of elementspublic <any> readMono(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
Mono
of the given type form the given input message, and returns it.readMono
in interface HttpMessageReader<T>
elementType
- the stream element type to return. This type must have previously been
passed to the canRead
method of this interface, which must have
returned true
.inputMessage
- the HTTP input message to read fromhints
- additional information about how to read the bodyMono
of objectpublic java.util.List<MediaType> getReadableMediaTypes()
HttpMessageReader
MediaType
objects that can be read by this converter.getReadableMediaTypes
in interface HttpMessageReader<T>
public <any> read(ResolvableType streamType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, java.util.Map<java.lang.String,java.lang.Object> hints)
ServerHttpMessageReader
Flux
of the given type form the given input message with additional server related
parameters which could be used to create some hints or set the response status for example.
Return hints that can be used to customize how the body should be readread
in interface ServerHttpMessageReader<T>
streamType
- the original type used in the method parameter. For annotation
based controllers, the MethodParameter
is available via ResolvableType.getSource()
.elementType
- the stream element type to return
Typically the value of a Content-Type
header.request
- the current HTTP requestresponse
- the current HTTP responsehints
- additional information about how to read the bodyFlux
of elementspublic <any> readMono(ResolvableType streamType, ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response, java.util.Map<java.lang.String,java.lang.Object> hints)
ServerHttpMessageReader
Mono
of the given type form the given input message with additional server related
parameters which could be used to create some hints or set the response status for example.
Return hints that can be used to customize how the body should be readreadMono
in interface ServerHttpMessageReader<T>
streamType
- the original type used in the method parameter. For annotation
based controllers, the MethodParameter
is available via ResolvableType.getSource()
.elementType
- the stream element type to return
Typically the value of a Content-Type
header.request
- the current HTTP requestresponse
- the current HTTP responsehints
- additional information about how to read the bodyMono
of objectprotected abstract java.util.Map<java.lang.String,java.lang.Object> resolveReadHints(ResolvableType streamType, ResolvableType elementType, ServerHttpRequest request)
read(ResolvableType, ResolvableType, ServerHttpRequest, ServerHttpResponse, Map)
.streamType
- the original type used for the method return value. For annotation
based controllers, the MethodParameter
is available via ResolvableType.getSource()
.elementType
- the stream element type to processrequest
- the current HTTP request