Class SpringManyMultipartFilesReader

java.lang.Object
org.springframework.http.converter.AbstractHttpMessageConverter<org.springframework.web.multipart.MultipartFile[]>
feign.form.spring.converter.SpringManyMultipartFilesReader
All Implemented Interfaces:
org.springframework.http.converter.HttpMessageConverter<org.springframework.web.multipart.MultipartFile[]>

public class SpringManyMultipartFilesReader extends org.springframework.http.converter.AbstractHttpMessageConverter<org.springframework.web.multipart.MultipartFile[]>
Implementation of HttpMessageConverter that can read multipart/form-data HTTP bodies (writing is not handled because that is already supported by FormHttpMessageConverter).

This reader supports an array of MultipartFile as the mapping return class type - each multipart body is read into an underlying byte array (in memory) implemented via ByteArrayMultipartFile.

  • Field Summary

    Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct an AbstractHttpMessageConverter that can read mulitpart/form-data.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    canWrite(org.springframework.http.MediaType mediaType)
     
    protected org.springframework.web.multipart.MultipartFile[]
    readInternal(Class<? extends org.springframework.web.multipart.MultipartFile[]> clazz, org.springframework.http.HttpInputMessage inputMessage)
     
    protected boolean
    supports(Class<?> clazz)
     
    protected void
    writeInternal(org.springframework.web.multipart.MultipartFile[] byteArrayMultipartFiles, org.springframework.http.HttpOutputMessage outputMessage)
     

    Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter

    addDefaultHeaders, canRead, canRead, canWrite, getContentLength, getDefaultCharset, getDefaultContentType, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, supportsRepeatableWrites, write

    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.converter.HttpMessageConverter

    getSupportedMediaTypes
  • Constructor Details

    • SpringManyMultipartFilesReader

      public SpringManyMultipartFilesReader(int bufSize)
      Construct an AbstractHttpMessageConverter that can read mulitpart/form-data.
      Parameters:
      bufSize - The size of the buffer (in bytes) to read the HTTP multipart body.
  • Method Details

    • canWrite

      protected boolean canWrite(org.springframework.http.MediaType mediaType)
      Overrides:
      canWrite in class org.springframework.http.converter.AbstractHttpMessageConverter<org.springframework.web.multipart.MultipartFile[]>
    • supports

      protected boolean supports(Class<?> clazz)
      Specified by:
      supports in class org.springframework.http.converter.AbstractHttpMessageConverter<org.springframework.web.multipart.MultipartFile[]>
    • readInternal

      protected org.springframework.web.multipart.MultipartFile[] readInternal(Class<? extends org.springframework.web.multipart.MultipartFile[]> clazz, org.springframework.http.HttpInputMessage inputMessage) throws IOException
      Specified by:
      readInternal in class org.springframework.http.converter.AbstractHttpMessageConverter<org.springframework.web.multipart.MultipartFile[]>
      Throws:
      IOException
    • writeInternal

      protected void writeInternal(org.springframework.web.multipart.MultipartFile[] byteArrayMultipartFiles, org.springframework.http.HttpOutputMessage outputMessage)
      Specified by:
      writeInternal in class org.springframework.http.converter.AbstractHttpMessageConverter<org.springframework.web.multipart.MultipartFile[]>