Package org.springframework.http.codec.multipart

# 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 Summary

Fields
Modifier and Type
Field
Description
`static final Charset`
`DEFAULT_CHARSET`
THe default charset used by the writer.

### Fields inherited from class org.springframework.http.codec.LoggingCodecSupport

`logger`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`MultipartWriterSupport(List<MediaType> supportedMediaTypes)`
Constructor with the list of supported media types.

## Method Summary

Modifier and Type
Method
Description
`protected reactor.core.publisher.Mono<org.springframework.core.io.buffer.DataBuffer>`
`generateBoundaryLine(byte[] boundary, org.springframework.core.io.buffer.DataBufferFactory bufferFactory)`
`protected reactor.core.publisher.Mono<org.springframework.core.io.buffer.DataBuffer>`
`generateLastLine(byte[] boundary, org.springframework.core.io.buffer.DataBufferFactory bufferFactory)`
`protected byte[]`
`generateMultipartBoundary()`
Generate a multipart boundary.
`protected reactor.core.publisher.Mono<org.springframework.core.io.buffer.DataBuffer>`
`generateNewLine(org.springframework.core.io.buffer.DataBufferFactory bufferFactory)`
`protected reactor.core.publisher.Mono<org.springframework.core.io.buffer.DataBuffer>`
`generatePartHeaders(HttpHeaders headers, org.springframework.core.io.buffer.DataBufferFactory bufferFactory)`
`Charset`
`getCharset()`
Return the configured charset for part headers.
`protected MediaType`
`getMultipartMediaType(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.
`List<MediaType>`
`getWritableMediaTypes()`
`void`
`setCharset(Charset charset)`
Set the character set to use for part headers such as "Content-Disposition" (and its filename parameter).

### 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`

## 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<org.springframework.core.io.buffer.DataBuffer> generateBoundaryLine(byte[] boundary, org.springframework.core.io.buffer.DataBufferFactory bufferFactory)

### generateNewLine

protected reactor.core.publisher.Mono<org.springframework.core.io.buffer.DataBuffer> generateNewLine(org.springframework.core.io.buffer.DataBufferFactory bufferFactory)

### generateLastLine

protected reactor.core.publisher.Mono<org.springframework.core.io.buffer.DataBuffer> generateLastLine(byte[] boundary, org.springframework.core.io.buffer.DataBufferFactory bufferFactory)

### generatePartHeaders

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