Polishing
This commit is contained in:
parent
8d3264f680
commit
1513e7be63
|
|
@ -1140,8 +1140,8 @@ other method arguments.
|
|||
===== Working with the URI
|
||||
|
||||
For each of the main HTTP methods, the `RestTemplate` provides two variants that take
|
||||
either a String URI template, or `java.net.URI` as the first argument. When using a
|
||||
String URI template, encoding is automatically applied:
|
||||
either a String URI template or `java.net.URI` as the first argument. When using a String
|
||||
URI template, encoding is automatically applied:
|
||||
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
|
|
@ -1150,9 +1150,9 @@ String URI template, encoding is automatically applied:
|
|||
----
|
||||
|
||||
The resulting target URI is "http://example.com/hotel%20list". Alternatively you can
|
||||
provide an already prepared `java.net.URI` and that will be used as is.
|
||||
For more information on preparing URIs, or customizing how the `RestTemplate` expands
|
||||
URI templates, see <<web.adoc#mvc-uri-building,URI Links>> in the "Web Servlet" section.
|
||||
provide an already prepared `java.net.URI` that will be used as is. For more information
|
||||
on preparing URIs or customizing how the `RestTemplate` expands URI templates, see
|
||||
<<web.adoc#mvc-uri-building,URI Links>> in the "Web Servlet" section.
|
||||
|
||||
|
||||
[[rest-template-headers]]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
= UriComponents
|
||||
|
||||
`UriComponents` is comparable to `java.net.URI`. However it comes with a dedicated
|
||||
`UriComponentsBuilder` and support URI template variables:
|
||||
`UriComponentsBuilder` and supports URI template variables:
|
||||
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<3> Build `UriComponents`.
|
||||
<4> Expand URI variables, encode, and obtain the `URI`.
|
||||
|
||||
The above can be done as a single chain, and with a shortcut:
|
||||
The above can be done as a single chain and with a shortcut:
|
||||
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
|
|
@ -36,8 +36,6 @@ The above can be done as a single chain, and with a shortcut:
|
|||
----
|
||||
|
||||
|
||||
|
||||
|
||||
[[web-uribuilder]]
|
||||
= UriBuilder
|
||||
|
||||
|
|
@ -46,10 +44,10 @@ The above can be done as a single chain, and with a shortcut:
|
|||
from a URI template, as well as a way to share common properties such as a base URI,
|
||||
encoding strategy, and others.
|
||||
|
||||
Both the `RestTemplate` and the `WebClient` can be configured with a `UriBuilderFactory`,
|
||||
Both the `RestTemplate` and the `WebClient` can be configured with a `UriBuilderFactory`
|
||||
in order to customize how URIs are created from URI templates. The default implementation
|
||||
relies on `UriComponentsBuilder` internally and provides options to a common base URI,
|
||||
an alternative encoding mode strategy, and more.
|
||||
relies on `UriComponentsBuilder` internally and provides options to configure a common
|
||||
base URI, an alternative encoding mode strategy, and more.
|
||||
|
||||
An example of configuring the `RestTemplate`:
|
||||
|
||||
|
|
@ -100,8 +98,6 @@ An example of using the `DefaultUriBuilderFactory`:
|
|||
----
|
||||
|
||||
|
||||
|
||||
|
||||
[[web-uri-encoding]]
|
||||
= URI Encoding
|
||||
|
||||
|
|
@ -121,9 +117,9 @@ The encoding in `UriComponents` is comparable to the multi-argument constructor
|
|||
section of its class-level Javadoc.
|
||||
====
|
||||
|
||||
This default way of encoding *does not* encode all characters with reserved meaning, but
|
||||
only the ones that are illegal within a given URI component. If this is not what you
|
||||
expect you can use an alternative.
|
||||
This default encoding strategy *does not* encode all characters with reserved meaning,
|
||||
but rather only the ones that are illegal within a given URI component. If this is not
|
||||
what you expect you can use an alternative.
|
||||
|
||||
When using <<web-uribuilder,DefaultUriBuilderFactory>> you can switch to an alternative
|
||||
encoding strategy:
|
||||
|
|
@ -140,6 +136,6 @@ encoding strategy:
|
|||
|
||||
The above encoding strategy applies `UriUtils.encode(String, Charset)` to each URI
|
||||
variable value prior to expanding it. Effectively it encodes all characters with reserved
|
||||
meaning, therefore ensuring that expanded URI variable do not have any impact on the
|
||||
meaning, therefore ensuring that expanded URI variables do not have any impact on the
|
||||
structure or meaning of the URI.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue