public class MultipartHttpMessageReader extends java.lang.Object implements HttpMessageReader<MultiValueMap<java.lang.String,Part>>
HttpMessageReader
for reading "multipart/form-data"
requests
into a MultiValueMap<String, Part>
.
Note that this reader depends on access to an
HttpMessageReader<Part>
for the actual parsing of multipart content.
The purpose of this reader is to collect the parts into a map.
Modifier and Type | Field and Description |
---|---|
private static ResolvableType |
MULTIPART_VALUE_TYPE |
private HttpMessageReader<Part> |
partReader |
Constructor and Description |
---|
MultipartHttpMessageReader(HttpMessageReader<Part> partReader) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead(ResolvableType elementType,
MediaType mediaType)
Whether the given object type is supported by this reader.
|
java.util.List<MediaType> |
getReadableMediaTypes()
Return the
MediaType 's that this reader supports. |
<any> |
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.
|
<any> |
readMono(ResolvableType elementType,
ReactiveHttpInputMessage inputMessage,
java.util.Map<java.lang.String,java.lang.Object> hints)
Read from the input message and encode to a single object.
|
private java.util.List<Part> |
toList(java.util.Collection<Part> collection) |
private LinkedMultiValueMap<java.lang.String,Part> |
toMultiValueMap(java.util.Map<java.lang.String,java.util.Collection<Part>> map) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
read, readMono
private static final ResolvableType MULTIPART_VALUE_TYPE
private final HttpMessageReader<Part> partReader
public MultipartHttpMessageReader(HttpMessageReader<Part> partReader)
public java.util.List<MediaType> getReadableMediaTypes()
HttpMessageReader
MediaType
's that this reader supports.getReadableMediaTypes
in interface HttpMessageReader<MultiValueMap<java.lang.String,Part>>
public boolean canRead(ResolvableType elementType, @Nullable MediaType mediaType)
HttpMessageReader
canRead
in interface HttpMessageReader<MultiValueMap<java.lang.String,Part>>
elementType
- the type of object to checkmediaType
- the media type for the read (possibly null
)true
if readable, false
otherwisepublic <any> read(ResolvableType elementType, ReactiveHttpInputMessage message, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
read
in interface HttpMessageReader<MultiValueMap<java.lang.String,Part>>
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 <any> readMono(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
readMono
in interface HttpMessageReader<MultiValueMap<java.lang.String,Part>>
elementType
- the type of objects in the stream which must have been
previously checked via HttpMessageReader.canRead(ResolvableType, MediaType)
inputMessage
- the message to read fromhints
- additional information about how to read and decode the inputprivate LinkedMultiValueMap<java.lang.String,Part> toMultiValueMap(java.util.Map<java.lang.String,java.util.Collection<Part>> map)