org.springframework.http.converter
Class FormHttpMessageConverter

java.lang.Object
  extended by org.springframework.http.converter.AbstractHttpMessageConverter<MultiValueMap<String,String>>
      extended by org.springframework.http.converter.FormHttpMessageConverter
All Implemented Interfaces:
HttpMessageConverter<MultiValueMap<String,String>>

public class FormHttpMessageConverter
extends AbstractHttpMessageConverter<MultiValueMap<String,String>>

Implementation of HttpMessageConverter that can read and write form data.

By default, this converter reads and writes the media type (application/x-www-form-urlencoded). This can be overridden by setting the supportedMediaTypes property. Form data is read from and written into a MultiValueMap<String, String>.

Since:
3.0
Author:
Arjen Poutsma
See Also:
MultiValueMap

Field Summary
static Charset DEFAULT_CHARSET
           
 
Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
logger
 
Constructor Summary
FormHttpMessageConverter()
          Creates a new instance of the FormHttpMessageConverter.
 
Method Summary
 MultiValueMap<String,String> readInternal(Class<MultiValueMap<String,String>> clazz, HttpInputMessage inputMessage)
          Abstract template method that reads the actualy object.
 boolean supports(Class<? extends MultiValueMap<String,String>> clazz)
          Indicate whether the given class is supported by this converter.
protected  void writeInternal(MultiValueMap<String,String> form, HttpOutputMessage outputMessage)
          Abstract template method that writes the actual body.
 
Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
getContentLength, getContentType, getSupportedMediaTypes, read, setSupportedMediaTypes, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CHARSET

public static final Charset DEFAULT_CHARSET
Constructor Detail

FormHttpMessageConverter

public FormHttpMessageConverter()
Creates a new instance of the FormHttpMessageConverter.

Method Detail

supports

public boolean supports(Class<? extends MultiValueMap<String,String>> clazz)
Description copied from interface: HttpMessageConverter
Indicate whether the given class is supported by this converter.

Parameters:
clazz - the class to test for support
Returns:
true if supported; false otherwise

readInternal

public MultiValueMap<String,String> readInternal(Class<MultiValueMap<String,String>> clazz,
                                                 HttpInputMessage inputMessage)
                                          throws IOException
Description copied from class: AbstractHttpMessageConverter
Abstract template method that reads the actualy object. Invoked from AbstractHttpMessageConverter.read(Class, HttpInputMessage).

Specified by:
readInternal in class AbstractHttpMessageConverter<MultiValueMap<String,String>>
Parameters:
clazz - the type of object to return
inputMessage - the HTTP input message to read from
Returns:
the converted object
Throws:
IOException - in case of I/O errors

writeInternal

protected void writeInternal(MultiValueMap<String,String> form,
                             HttpOutputMessage outputMessage)
                      throws IOException
Description copied from class: AbstractHttpMessageConverter
Abstract template method that writes the actual body. Invoked from AbstractHttpMessageConverter.write(Object, HttpOutputMessage).

Specified by:
writeInternal in class AbstractHttpMessageConverter<MultiValueMap<String,String>>
Parameters:
form - the object to write to the output message
outputMessage - the message to write to
Throws:
IOException - in case of I/O errors