public class FormHttpMessageReader extends java.lang.Object implements HttpMessageReader<MultiValueMap<java.lang.String,java.lang.String>>
HttpMessageReader
to read HTML form data, i.e.
request body with media type "application/x-www-form-urlencoded"
.Modifier and Type | Field and Description |
---|---|
static java.nio.charset.Charset |
DEFAULT_CHARSET |
private java.nio.charset.Charset |
defaultCharset |
private static ResolvableType |
MULTIVALUE_TYPE |
Constructor and Description |
---|
FormHttpMessageReader() |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead(ResolvableType elementType,
MediaType mediaType)
Indicates whether the given class can be read by this converter.
|
java.nio.charset.Charset |
getDefaultCharset()
Return the configured default charset.
|
private java.nio.charset.Charset |
getMediaTypeCharset(MediaType mediaType) |
java.util.List<MediaType> |
getReadableMediaTypes()
Return the list of
MediaType objects that can be read by this converter. |
private MultiValueMap<java.lang.String,java.lang.String> |
parseFormData(java.nio.charset.Charset charset,
java.lang.String body) |
<any> |
read(ResolvableType elementType,
ReactiveHttpInputMessage inputMessage,
java.util.Map<java.lang.String,java.lang.Object> hints)
Read a
Flux of the given type form the given input message, and returns it. |
<any> |
readMono(ResolvableType elementType,
ReactiveHttpInputMessage inputMessage,
java.util.Map<java.lang.String,java.lang.Object> hints)
Read a
Mono of the given type form the given input message, and returns it. |
void |
setDefaultCharset(java.nio.charset.Charset charset)
Set the default character set to use for reading form data when the
request Content-Type header does not explicitly specify it.
|
public static final java.nio.charset.Charset DEFAULT_CHARSET
private static final ResolvableType MULTIVALUE_TYPE
private java.nio.charset.Charset defaultCharset
public void setDefaultCharset(java.nio.charset.Charset charset)
By default this is set to "UTF-8".
public java.nio.charset.Charset getDefaultCharset()
public boolean canRead(ResolvableType elementType, MediaType mediaType)
HttpMessageReader
canRead
in interface HttpMessageReader<MultiValueMap<java.lang.String,java.lang.String>>
elementType
- the stream element type to test for readabilitymediaType
- the media type to read, can be null
if not specified.
Typically the value of a Content-Type
header.true
if readable; false
otherwisepublic <any> read(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
Flux
of the given type form the given input message, and returns it.read
in interface HttpMessageReader<MultiValueMap<java.lang.String,java.lang.String>>
elementType
- the stream element type to return. This type must have previously been
passed to the canRead
method of this interface, which must have
returned true
.inputMessage
- the HTTP input message to read fromhints
- additional information about how to read the bodyFlux
of elementspublic <any> readMono(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, java.util.Map<java.lang.String,java.lang.Object> hints)
HttpMessageReader
Mono
of the given type form the given input message, and returns it.readMono
in interface HttpMessageReader<MultiValueMap<java.lang.String,java.lang.String>>
elementType
- the stream element type to return. This type must have previously been
passed to the canRead
method of this interface, which must have
returned true
.inputMessage
- the HTTP input message to read fromhints
- additional information about how to read the bodyMono
of objectprivate java.nio.charset.Charset getMediaTypeCharset(MediaType mediaType)
private MultiValueMap<java.lang.String,java.lang.String> parseFormData(java.nio.charset.Charset charset, java.lang.String body)
public java.util.List<MediaType> getReadableMediaTypes()
HttpMessageReader
MediaType
objects that can be read by this converter.getReadableMediaTypes
in interface HttpMessageReader<MultiValueMap<java.lang.String,java.lang.String>>