org.springframework.http.codec

Class FormHttpMessageWriter

    • Field Detail

      • DEFAULT_CHARSET

        public static final java.nio.charset.Charset DEFAULT_CHARSET
        The default charset used by the writer.
    • Constructor Detail

      • FormHttpMessageWriter

        public FormHttpMessageWriter()
    • Method Detail

      • setDefaultCharset

        public void setDefaultCharset(java.nio.charset.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".

      • getDefaultCharset

        public java.nio.charset.Charset getDefaultCharset()
        Return the configured default charset.
      • canWrite

        public boolean canWrite(ResolvableType elementType,
                                @Nullable
                                MediaType mediaType)
        Description copied from interface: HttpMessageWriter
        Whether the given object type is supported by this writer.
        Specified by:
        canWrite in interface HttpMessageWriter<MultiValueMap<java.lang.String,java.lang.String>>
        Parameters:
        elementType - the type of object to check
        mediaType - the media type for the write, possibly null
        Returns:
        true if writable, false otherwise
      • write

        public reactor.core.publisher.Mono<java.lang.Void> write(org.reactivestreams.Publisher<? extends MultiValueMap<java.lang.String,java.lang.String>> inputStream,
                                                                 ResolvableType elementType,
                                                                 @Nullable
                                                                 MediaType mediaType,
                                                                 ReactiveHttpOutputMessage message,
                                                                 java.util.Map<java.lang.String,java.lang.Object> hints)
        Description copied from interface: HttpMessageWriter
        Write an given stream of object to the output message.
        Specified by:
        write in interface HttpMessageWriter<MultiValueMap<java.lang.String,java.lang.String>>
        Parameters:
        inputStream - the objects to write
        elementType - the type of objects in the stream which must have been previously checked via HttpMessageWriter.canWrite(ResolvableType, MediaType)
        mediaType - the content type for the write, possibly null to indicate that the default content type of the writer must be used.
        message - the message to write to
        hints - additional information about how to encode and write
        Returns:
        indicates completion or error
      • serializeForm

        protected java.lang.String serializeForm(MultiValueMap<java.lang.String,java.lang.String> formData,
                                                 java.nio.charset.Charset charset)