Class MultipartHttpMessageReader
- java.lang.Object
- org.springframework.http.codec.LoggingCodecSupport
- org.springframework.http.codec.multipart.MultipartHttpMessageReader
- All Implemented Interfaces:
HttpMessageReader<MultiValueMap<String,Part>>
public class MultipartHttpMessageReader extends LoggingCodecSupport implements HttpMessageReader<MultiValueMap<String,Part>>
HttpMessageReaderfor reading"multipart/form-data"requests into aMultiValueMap<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.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
Field Summary
Fields inherited from class org.springframework.http.codec.LoggingCodecSupport
logger
Constructor Summary
Constructors Constructor Description MultipartHttpMessageReader(HttpMessageReader<Part> partReader)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanRead(ResolvableType elementType, MediaType mediaType)Whether the given object type is supported by this reader.HttpMessageReader<Part>getPartReader()Return the configured parts reader.List<MediaType>getReadableMediaTypes()Return theMediaType's that this reader supports.reactor.core.publisher.Flux<MultiValueMap<String,Part>>read(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)Read from the input message and encode to a stream of objects.reactor.core.publisher.Mono<MultiValueMap<String,Part>>readMono(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, Map<String,Object> hints)Read from the input message and encode to a single object.Methods inherited from class org.springframework.http.codec.LoggingCodecSupport
isEnableLoggingRequestDetails, setEnableLoggingRequestDetails
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.http.codec.HttpMessageReader
read, readMono
Constructor Detail
MultipartHttpMessageReader
public MultipartHttpMessageReader(HttpMessageReader<Part> partReader)
Method Detail
getPartReader
public HttpMessageReader<Part> getPartReader()
Return the configured parts reader.- Since:
- 5.1.11
getReadableMediaTypes
public List<MediaType> getReadableMediaTypes()
Description copied from interface:HttpMessageReaderReturn theMediaType's that this reader supports.- Specified by:
getReadableMediaTypesin interfaceHttpMessageReader<MultiValueMap<String,Part>>
canRead
public boolean canRead(ResolvableType elementType, @Nullable MediaType mediaType)
Description copied from interface:HttpMessageReaderWhether the given object type is supported by this reader.- Specified by:
canReadin interfaceHttpMessageReader<MultiValueMap<String,Part>>- Parameters:
elementType- the type of object to checkmediaType- the media type for the read (possiblynull)- Returns:
trueif readable,falseotherwise
read
public reactor.core.publisher.Flux<MultiValueMap<String,Part>> read(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
Description copied from interface:HttpMessageReaderRead from the input message and encode to a stream of objects.- Specified by:
readin interfaceHttpMessageReader<MultiValueMap<String,Part>>- Parameters:
elementType- the type of objects in the stream which must have been previously checked viaHttpMessageReader.canRead(ResolvableType, MediaType)message- the message to read fromhints- additional information about how to read and decode the input- Returns:
- the decoded stream of elements
readMono
public reactor.core.publisher.Mono<MultiValueMap<String,Part>> readMono(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, Map<String,Object> hints)
Description copied from interface:HttpMessageReaderRead from the input message and encode to a single object.- Specified by:
readMonoin interfaceHttpMessageReader<MultiValueMap<String,Part>>- Parameters:
elementType- the type of objects in the stream which must have been previously checked viaHttpMessageReader.canRead(ResolvableType, MediaType)inputMessage- the message to read fromhints- additional information about how to read and decode the input- Returns:
- the decoded object