Code example for FormHttpMessageConverter

Methods: setCharsetsetPartConverters

0
	 * By default, the message converter is set to use "UTF-8" character encoding. 
	 * Override to customize the message converter (for example, to set supported media types or message converters for the parts of a multipart message).  
	 * To remove/replace this or any of the other message converters that are registered by default, override the getMessageConverters() method instead. 
	 */ 
	protected FormHttpMessageConverter getFormMessageConverter() {
		FormHttpMessageConverter converter = new FormHttpMessageConverter();
		converter.setCharset(Charset.forName("UTF-8"));
		List<HttpMessageConverter<?>> partConverters = new ArrayList<HttpMessageConverter<?>>();
		partConverters.add(new ByteArrayHttpMessageConverter());
		StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
		stringHttpMessageConverter.setWriteAcceptCharset(false);
		partConverters.add(stringHttpMessageConverter);
		partConverters.add(new ResourceHttpMessageConverter());		
		converter.setPartConverters(partConverters);
		return converter;
	} 
 
	/** 
	 * Returns a {@link MappingJackson2HttpMessageConverter} to be used by the internal {@link RestTemplate}. 
	 * Override to customize the message converter (for example, to set a custom object mapper or supported media types).