diff --git a/framework-docs/modules/ROOT/pages/integration/rest-clients.adoc b/framework-docs/modules/ROOT/pages/integration/rest-clients.adoc index 2be5a64679b..54ab2d19f9e 100644 --- a/framework-docs/modules/ROOT/pages/integration/rest-clients.adoc +++ b/framework-docs/modules/ROOT/pages/integration/rest-clients.adoc @@ -71,8 +71,34 @@ This can be done with `method(HttpMethod)` or with the convenience methods `get( Next, the request URI can be specified with the `uri` methods. This step is optional and can be skipped if the `RestClient` is configured with a default URI. The URL is typically specified as a `String`, with optional URI template variables. -String URLs are encoded by default, but this can be changed by building a client with a custom `uriBuilderFactory`. +The following example configures a GET request to `"https://example.com/orders/42`: +[tabs] +====== +Java:: ++ +[source,java,indent=0,subs="verbatim,quotes",role="primary"] +---- +int id = 42; +restClient.get() + .uri("https://example.com/orders/{id}", id) + .... +---- + +Kotlin:: ++ +[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"] +---- +val id = 42 +restClient.get() + .uri("https://example.com/orders/{id}", id) + ... +---- +====== + +A function can also be used for more controls, such as specifying xref:web/webmvc/mvc-uri-building.adoc[request parameters]. + +String URLs are encoded by default, but this can be changed by building a client with a custom `uriBuilderFactory`. The URL can also be provided with a function or as a `java.net.URI`, both of which are not encoded. For more details on working with and encoding URIs, see xref:web/webmvc/mvc-uri-building.adoc[URI Links].