open class MultipartHttpMessageWriter : HttpMessageWriter<MultiValueMap<String, *>>
HttpMessageWriter for writing a MultiValueMap<String, ?>
as multipart form data, i.e. "multipart/form-data"
, to the body of a request.
The serialization of individual parts is delegated to other writers. By default only String and Resource parts are supported but you can configure others through a constructor argument.
This writer can be configured with a FormHttpMessageWriter to delegate to. It is the preferred way of supporting both form data and multipart data (as opposed to registering each writer separately) so that when the MediaType is not specified and generics are not present on the target element type, we can inspect the values in the actual map and decide whether to write plain form data (String values only) or otherwise.
Author
Sebastien Deleuze
Author
Rossen Stoyanchev
Since
5.0
See Also
FormHttpMessageWriter
MultipartHttpMessageWriter()
Constructor with a default list of part writers (String and Resource). MultipartHttpMessageWriter(partWriters: MutableList<HttpMessageWriter<*>>)
Constructor with explicit list of writers for serializing parts. MultipartHttpMessageWriter(partWriters: MutableList<HttpMessageWriter<*>>, formWriter: HttpMessageWriter<MultiValueMap<String, String>>)
Constructor with explicit list of writers for serializing parts and a writer for plain form data to fall back when no media type is specified and the actual map consists of String values only. |
static val DEFAULT_CHARSET: Charset |
open fun canWrite(elementType: ResolvableType, mediaType: MediaType): Boolean |
|
open fun getCharset(): Charset
Return the configured charset for part headers. |
|
open fun getWritableMediaTypes(): MutableList<MediaType> |
|
open fun setCharset(charset: Charset): Unit
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". |
|
open fun write(inputStream: Publisher<out MultiValueMap<String, *>>, elementType: ResolvableType, mediaType: MediaType, outputMessage: ReactiveHttpOutputMessage, hints: MutableMap<String, Any>): Mono<Void> |