HttpMessageWriter for writing a MultiValueMap<String, String>
as HTML form data, i.e. "application/x-www-form-urlencoded", to the
body of a request.
Note that unless the media type is explicitly set to
MediaType#APPLICATION_FORM_URLENCODED, the canWrite method
will need generic type information to confirm the target map has String values.
This is because a MultiValueMap with non-String values can be used to write
multipart requests.
To support both form data and multipart requests, consider using
org.
configured with this writer as the fallback for writing plain form data.
org.springframework.http.codec.multipart.MultipartHttpMessageWriter
| Modifier and Type | Field and Description |
|---|---|
| public static final Charset | DEFAULT_CHARSET
The default charset used by the writer. |
| private static final MediaType | |
| private Charset | |
| private static final List | |
| private static final ResolvableType |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canWrite(ResolvableType
the type of object to check elementType, MediaType the media type for the write (possibly mediaType)null)Implements org. |
| public Charset | |
| protected MediaType | |
| public List | getWritableMediaTypes()
Implements org. |
| private void | |
| protected String | |
| public void | setDefaultCharset(Charset charset)
Set the default character set to use for writing form data when the response Content-Type header does not explicitly specify it. |
| public Mono | write(Publisher<? extends MultiValueMap<String, String>>
the objects to write inputStream, ResolvableType the type of objects in the stream which must have been
previously checked via elementType, MediaType canWrite(ResolvableType, MediaType)the content type for the write (possibly mediaType, ReactiveHttpOutputMessage null to
indicate that the default content type of the writer must be used)the message to write to message, Map<String, Object> additional information about how to encode and write hints)Implements org. |
| DEFAULT_CHARSET | back to summary |
|---|---|
| public static final Charset DEFAULT_CHARSET The default charset used by the writer. | |
| DEFAULT_FORM_DATA_MEDIA_TYPE | back to summary |
|---|---|
| private static final MediaType DEFAULT_FORM_DATA_MEDIA_TYPE | |
| defaultCharset | back to summary |
|---|---|
| private Charset defaultCharset | |
| MEDIA_TYPES | back to summary |
|---|---|
| private static final List<MediaType> MEDIA_TYPES | |
| MULTIVALUE_TYPE | back to summary |
|---|---|
| private static final ResolvableType MULTIVALUE_TYPE | |
| FormHttpMessageWriter | back to summary |
|---|---|
| public FormHttpMessageWriter() | |
| canWrite | back to summary |
|---|---|
| public boolean canWrite(ResolvableType elementType, MediaType mediaType) Implements org. Doc from org. Whether the given object type is supported by this writer.
| |
| getDefaultCharset | back to summary |
|---|---|
| public Charset getDefaultCharset() Return the configured default charset. | |
| getMediaType | back to summary |
|---|---|
| protected MediaType getMediaType(MediaType mediaType) | |
| getWritableMediaTypes | back to summary |
|---|---|
| public List Implements org. Doc from org. Return the list of media types supported by this Writer. The list may not
apply to every possible target element type and calls to this method should
typically be guarded via | |
| logFormData | back to summary |
|---|---|
| private void logFormData(MultiValueMap<String, String> form, Map<String, Object> hints) | |
| serializeForm | back to summary |
|---|---|
| protected String serializeForm(MultiValueMap<String, String> formData, Charset charset) | |
| setDefaultCharset | back to summary |
|---|---|
| public void setDefaultCharset(Charset charset) Set the default character set to use for writing form data when the response Content-Type header does not explicitly specify it. By default this is set to "UTF-8". | |
| write | back to summary |
|---|---|
| public Mono Implements org. Doc from org. Write a given stream of object to the output message.
| |