Class MultipartHttpMessageReader

java.lang.Object
org.springframework.http.codec.LoggingCodecSupport
org.springframework.http.codec.multipart.MultipartHttpMessageReader
All Implemented Interfaces:
HttpMessageReader<org.springframework.util.MultiValueMap<String,Part>>

public class MultipartHttpMessageReader extends LoggingCodecSupport implements HttpMessageReader<org.springframework.util.MultiValueMap<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.

Since:
5.0
Author:
Rossen Stoyanchev
  • Constructor Details

  • Method Details

    • getPartReader

      public HttpMessageReader<Part> getPartReader()
      Return the configured parts reader.
      Since:
      5.1.11
    • getReadableMediaTypes

      public List<MediaType> getReadableMediaTypes()
      Description copied from interface: HttpMessageReader
      Return 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 via canWrite(elementType, null). The list may also exclude media types supported only for a specific element type. Alternatively, use HttpMessageReader.getReadableMediaTypes(ResolvableType) for a more precise list.
      Specified by:
      getReadableMediaTypes in interface HttpMessageReader<org.springframework.util.MultiValueMap<String,Part>>
      Returns:
      the general list of supported media types
    • canRead

      public boolean canRead(org.springframework.core.ResolvableType elementType, @Nullable MediaType mediaType)
      Description copied from interface: HttpMessageReader
      Whether the given object type is supported by this reader.
      Specified by:
      canRead in interface HttpMessageReader<org.springframework.util.MultiValueMap<String,Part>>
      Parameters:
      elementType - the type of object to check
      mediaType - the media type for the read (possibly null)
      Returns:
      true if readable, false otherwise
    • read

      public reactor.core.publisher.Flux<org.springframework.util.MultiValueMap<String,Part>> read(org.springframework.core.ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
      Description copied from interface: HttpMessageReader
      Read from the input message and decode to a stream of objects.
      Specified by:
      read in interface HttpMessageReader<org.springframework.util.MultiValueMap<String,Part>>
      Parameters:
      elementType - the type of objects in the stream which must have been previously checked via HttpMessageReader.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
    • readMono

      public reactor.core.publisher.Mono<org.springframework.util.MultiValueMap<String,Part>> readMono(org.springframework.core.ResolvableType elementType, ReactiveHttpInputMessage inputMessage, Map<String,Object> hints)
      Description copied from interface: HttpMessageReader
      Read from the input message and decode to a single object.
      Specified by:
      readMono in interface HttpMessageReader<org.springframework.util.MultiValueMap<String,Part>>
      Parameters:
      elementType - the type of objects in the stream which must have been previously checked via HttpMessageReader.canRead(ResolvableType, MediaType)
      inputMessage - the message to read from
      hints - additional information about how to read and decode the input
      Returns:
      the decoded object