Skip to content

Commit 40596d4

Browse files
committed
Provide a more explicit link to URI composition examples
Closes gh-32685
1 parent cb5b9dc commit 40596d4

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

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

+27-1
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,34 @@ This can be done with `method(HttpMethod)` or with the convenience methods `get(
7171
Next, the request URI can be specified with the `uri` methods.
7272
This step is optional and can be skipped if the `RestClient` is configured with a default URI.
7373
The URL is typically specified as a `String`, with optional URI template variables.
74-
String URLs are encoded by default, but this can be changed by building a client with a custom `uriBuilderFactory`.
74+
The following example configures a GET request to `"https://example.com/orders/42`:
75+
76+
[tabs]
77+
======
78+
Java::
79+
+
80+
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
81+
----
82+
int id = 42;
83+
restClient.get()
84+
.uri("https://example.com/orders/{id}", id)
85+
....
86+
----
7587
88+
Kotlin::
89+
+
90+
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
91+
----
92+
val id = 42
93+
restClient.get()
94+
.uri("https://example.com/orders/{id}", id)
95+
...
96+
----
97+
======
98+
99+
A function can also be used for more controls, such as specifying xref:web/webmvc/mvc-uri-building.adoc[request parameters].
100+
101+
String URLs are encoded by default, but this can be changed by building a client with a custom `uriBuilderFactory`.
76102
The URL can also be provided with a function or as a `java.net.URI`, both of which are not encoded.
77103
For more details on working with and encoding URIs, see xref:web/webmvc/mvc-uri-building.adoc[URI Links].
78104

0 commit comments

Comments
 (0)