Skip to content

Commit 5cb3ea2

Browse files
committed
Polishing in RestClient reference docs
1 parent cce2771 commit 5cb3ea2

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

framework-docs/modules/ROOT/pages/integration/rest-clients.adoc

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,24 @@ The Spring Framework provides the following choices for making calls to REST end
1212
[[rest-restclient]]
1313
== `RestClient`
1414

15-
The `RestClient` is a synchronous HTTP client that offers a modern, fluent API.
16-
It offers an abstraction over HTTP libraries that allows for convenient conversion from a Java object to an HTTP request, and the creation of objects from an HTTP response.
15+
`RestClient` is a synchronous HTTP client that provides a fluent API to perform requests.
16+
It serves as an abstraction over HTTP libraries, and handles conversion of HTTP request and response content to and from higher level Java objects.
1717

18-
=== Creating a `RestClient`
18+
=== Create a `RestClient`
1919

20-
The `RestClient` is created using one of the static `create` methods.
21-
You can also use `builder()` to get a builder with further options, such as specifying which HTTP library to use (see <<rest-request-factories>>) and which message converters to use (see <<rest-message-conversion>>), setting a default URI, default path variables, default request headers, or `uriBuilderFactory`, or registering interceptors and initializers.
20+
`RestClient` has static `create` shortcut methods.
21+
It also exposes a `builder()` with further options:
2222

23-
Once created (or built), the `RestClient` can be used safely by multiple threads.
23+
- select the HTTP library to use, see <<rest-request-factories>>
24+
- configure message converters, see <<rest-message-conversion>>
25+
- set a baseUrl
26+
- set default request headers, cookies, path variables
27+
- register interceptors
28+
- register request initializers
2429

25-
The following sample shows how to create a default `RestClient`, and how to build a custom one.
30+
Once created, a `RestClient` is safe to use in multiple threads.
31+
32+
The below shows how to create or build a `RestClient`:
2633

2734
[tabs]
2835
======
@@ -63,17 +70,17 @@ Kotlin::
6370
----
6471
======
6572

66-
=== Using the `RestClient`
73+
=== Use the `RestClient`
6774

68-
When making an HTTP request with the `RestClient`, the first thing to specify is which HTTP method to use.
69-
This can be done with `method(HttpMethod)` or with the convenience methods `get()`, `head()`, `post()`, and so on.
75+
To perform an HTTP request, first specify the HTTP method to use.
76+
Use the convenience methods like `get()`, `head()`, `post()`, and others, or `method(HttpMethod)`.
7077

7178
==== Request URL
7279

73-
Next, the request URI can be specified with the `uri` methods.
74-
This step is optional and can be skipped if the `RestClient` is configured with a default URI.
80+
Next, specify the request URI with the `uri` methods.
81+
This is optional, and you can skip this step if you configured a baseUrl through the builder.
7582
The URL is typically specified as a `String`, with optional URI template variables.
76-
The following example configures a GET request to `https://example.com/orders/42`:
83+
The following shows how to perform a request:
7784

7885
[tabs]
7986
======

0 commit comments

Comments
 (0)