Class FormHttpMessageWriter

java.lang.Object
org.springframework.http.codec.LoggingCodecSupport
org.springframework.http.codec.FormHttpMessageWriter
All Implemented Interfaces:
HttpMessageWriter<MultiValueMap<String,String>>

public class FormHttpMessageWriter extends LoggingCodecSupport implements HttpMessageWriter<MultiValueMap<String,String>>
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(org.springframework.core.ResolvableType, org.springframework.http.MediaType) 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 MultipartHttpMessageWriter configured with this writer as the fallback for writing plain form data.

Since:
5.0
Author:
Sebastien Deleuze, Rossen Stoyanchev
See Also: