|
60 | 60 | import org.springframework.web.util.UriTemplateHandler; |
61 | 61 |
|
62 | 62 | /** |
63 | | - * <strong>Spring's central class for synchronous client-side HTTP access.</strong> |
64 | | - * It simplifies communication with HTTP servers, and enforces RESTful principles. |
65 | | - * It handles HTTP connections, leaving application code to provide URLs |
66 | | - * (with possible template variables) and extract results. |
| 63 | + * Synchronous client to perform HTTP requests, exposing a simple, template |
| 64 | + * method API over underlying HTTP client libraries such as the JDK |
| 65 | + * {@code HttpURLConnection}, Apache HttpComponents, and others. |
67 | 66 | * |
68 | | - * <p><strong>Note:</strong> by default the RestTemplate relies on standard JDK |
69 | | - * facilities to establish HTTP connections. You can switch to use a different |
70 | | - * HTTP library such as Apache HttpComponents, Netty, and OkHttp through the |
71 | | - * {@link #setRequestFactory} property. |
| 67 | + * <p>The RestTemplate offers templates for common scenarios by HTTP method, in |
| 68 | + * addition to the generalized {@code exchange} and {@code execute} methods that |
| 69 | + * support of less frequent cases. |
72 | 70 | * |
73 | | - * <p>The main entry points of this template are the methods named after the six main HTTP methods: |
74 | | - * <table> |
75 | | - * <tr><th>HTTP method</th><th>RestTemplate methods</th></tr> |
76 | | - * <tr><td>DELETE</td><td>{@link #delete}</td></tr> |
77 | | - * <tr><td>GET</td><td>{@link #getForObject}</td></tr> |
78 | | - * <tr><td></td><td>{@link #getForEntity}</td></tr> |
79 | | - * <tr><td>HEAD</td><td>{@link #headForHeaders}</td></tr> |
80 | | - * <tr><td>OPTIONS</td><td>{@link #optionsForAllow}</td></tr> |
81 | | - * <tr><td>POST</td><td>{@link #postForLocation}</td></tr> |
82 | | - * <tr><td></td><td>{@link #postForObject}</td></tr> |
83 | | - * <tr><td>PUT</td><td>{@link #put}</td></tr> |
84 | | - * <tr><td>any</td><td>{@link #exchange}</td></tr> |
85 | | - * <tr><td></td><td>{@link #execute}</td></tr> </table> |
86 | | - * |
87 | | - * <p>In addition the {@code exchange} and {@code execute} methods are generalized versions of |
88 | | - * the above methods and can be used to support additional, less frequent combinations (e.g. |
89 | | - * HTTP PATCH, HTTP PUT with response body, etc.). Note however that the underlying HTTP |
90 | | - * library used must also support the desired combination. |
91 | | - * |
92 | | - * <p><strong>Note:</strong> For URI templates it is assumed encoding is necessary, e.g. |
93 | | - * {@code restTemplate.getForObject("http://example.com/hotel list")} becomes |
94 | | - * {@code "http://example.com/hotel%20list"}. This also means if the URI template |
95 | | - * or URI variables are already encoded, double encoding will occur, e.g. |
96 | | - * {@code http://example.com/hotel%20list} becomes |
97 | | - * {@code http://example.com/hotel%2520list}). To avoid that use a {@code URI} method |
98 | | - * variant to provide (or re-use) a previously encoded URI. To prepare such an URI |
99 | | - * with full control over encoding, consider using |
100 | | - * {@link org.springframework.web.util.UriComponentsBuilder}. |
101 | | - * |
102 | | - * <p>Internally the template uses {@link HttpMessageConverter} instances to |
103 | | - * convert HTTP messages to and from POJOs. Converters for the main mime types |
104 | | - * are registered by default but you can also register additional converters |
105 | | - * via {@link #setMessageConverters}. |
106 | | - * |
107 | | - * <p>This template uses a |
108 | | - * {@link org.springframework.http.client.SimpleClientHttpRequestFactory} and a |
109 | | - * {@link DefaultResponseErrorHandler} as default strategies for creating HTTP |
110 | | - * connections or handling HTTP errors, respectively. These defaults can be overridden |
111 | | - * through {@link #setRequestFactory} and {@link #setErrorHandler} respectively. |
| 71 | + * <p><strong>NOTE:</strong> As of 5.0, the non-blocking, reactive |
| 72 | + * {@link org.springframework.web.reactive.client.WebClient WebClient} offers a |
| 73 | + * modern alternative to the {@code RestTemplate} with efficient support for |
| 74 | + * both sync and async, as well as streaming scenarios. The {@code RestTemplate} |
| 75 | + * will be deprecated in a future version and will not have major new features |
| 76 | + * gong forward. |
112 | 77 | * |
113 | 78 | * @author Arjen Poutsma |
114 | 79 | * @author Brian Clozel |
|
119 | 84 | * @see RequestCallback |
120 | 85 | * @see ResponseExtractor |
121 | 86 | * @see ResponseErrorHandler |
122 | | - * @see AsyncRestTemplate |
123 | 87 | */ |
124 | 88 | public class RestTemplate extends InterceptingHttpAccessor implements RestOperations { |
125 | 89 |
|
|
0 commit comments