Class MultipartWriterSupport

java.lang.Object
org.springframework.http.codec.LoggingCodecSupport
org.springframework.http.codec.multipart.MultipartWriterSupport
Direct Known Subclasses:
MultipartHttpMessageWriter, PartEventHttpMessageWriter, PartHttpMessageWriter

public class MultipartWriterSupport extends LoggingCodecSupport
Support class for multipart HTTP message writers.
Since:
5.3
Author:
Rossen Stoyanchev
  • Field Details

    • DEFAULT_CHARSET

      public static final Charset DEFAULT_CHARSET
      THe default charset used by the writer.
  • Constructor Details

    • MultipartWriterSupport

      protected MultipartWriterSupport(List<MediaType> supportedMediaTypes)
      Constructor with the list of supported media types.
  • Method Details

    • getCharset

      public Charset getCharset()
      Return the configured charset for part headers.
    • setCharset

      public void setCharset(Charset charset)
      Set the character set to use for part headers such as "Content-Disposition" (and its filename parameter).

      By default this is set to "UTF-8". If changed from this default, the "Content-Type" header will have a "charset" parameter that specifies the character set used.

    • getWritableMediaTypes

      public List<MediaType> getWritableMediaTypes()
    • generateMultipartBoundary

      protected byte[] generateMultipartBoundary()
      Generate a multipart boundary.

      By default delegates to MimeTypeUtils.generateMultipartBoundary().

    • getMultipartMediaType

      protected MediaType getMultipartMediaType(@Nullable MediaType mediaType, byte[] boundary)
      Prepare the MediaType to use by adding "boundary" and "charset" parameters to the given mediaType or "multipart/form-data" otherwise by default.
    • generateBoundaryLine

      protected reactor.core.publisher.Mono<DataBuffer> generateBoundaryLine(byte[] boundary, DataBufferFactory bufferFactory)
    • generateNewLine

      protected reactor.core.publisher.Mono<DataBuffer> generateNewLine(DataBufferFactory bufferFactory)
    • generateLastLine

      protected reactor.core.publisher.Mono<DataBuffer> generateLastLine(byte[] boundary, DataBufferFactory bufferFactory)
    • generatePartHeaders

      protected reactor.core.publisher.Mono<DataBuffer> generatePartHeaders(HttpHeaders headers, DataBufferFactory bufferFactory)