Correct documentation of default HttpMessageConverters in RestTemplate

Issue: SPR-7885

(cherry picked from commit 442ddb0)
This commit is contained in:
Juergen Hoeller
2018-03-19 20:38:14 +01:00
parent 0e7e49bab0
commit 977084a6b8
2 changed files with 32 additions and 36 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,8 +61,10 @@ import org.springframework.util.StringUtils;
*
* <p>For example, the following snippet shows how to submit an HTML form:
* <pre class="code">
* RestTemplate template = new RestTemplate(); // FormHttpMessageConverter is configured by default
* MultiValueMap&lt;String, String&gt; form = new LinkedMultiValueMap&lt;String, String&gt;();
* RestTemplate template = new RestTemplate();
* // AllEncompassingFormHttpMessageConverter is configured by default
*
* MultiValueMap&lt;String, String&gt; form = new LinkedMultiValueMap&lt;&gt;();
* form.add("field 1", "value 1");
* form.add("field 2", "value 2");
* form.add("field 2", "value 3");
@@ -71,7 +73,7 @@ import org.springframework.util.StringUtils;
*
* <p>The following snippet shows how to do a file upload:
* <pre class="code">
* MultiValueMap&lt;String, Object&gt; parts = new LinkedMultiValueMap&lt;String, Object&gt;();
* MultiValueMap&lt;String, Object&gt; parts = new LinkedMultiValueMap&lt;&gt;();
* parts.add("field 1", "value 1");
* parts.add("file", new ClassPathResource("myFile.jpg"));
* template.postForLocation("http://example.com/myFileUpload", parts);
@@ -84,7 +86,8 @@ import org.springframework.util.StringUtils;
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @since 3.0
* @see MultiValueMap
* @see org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter
* @see org.springframework.util.MultiValueMap
*/
public class FormHttpMessageConverter implements HttpMessageConverter<MultiValueMap<String, ?>> {