From 61181fb60b4b014ca3bfc3ba8d26e0d96903d2d2 Mon Sep 17 00:00:00 2001 From: Keith Lustria Date: Thu, 19 Oct 2023 05:48:14 -0700 Subject: [PATCH] 6456 webclient doc part2 4.x (#7845) * Doc clean up * Add note to refer to "Configuration Secrets" if encryption of secrets is needed --- docs/se/webclient.adoc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/se/webclient.adoc b/docs/se/webclient.adoc index f02114fd004..a0d31a9564d 100644 --- a/docs/se/webclient.adoc +++ b/docs/se/webclient.adoc @@ -99,7 +99,7 @@ WebClient offers a set of request methods that are used to specify the type of a * `put()` * `method(String methodName)` -Check out link:{webclient-javadoc-base-url}.api/io/helidon/webclient/api/HttpClient.html[HttpClient.html] API to learn more about request methods. These methods will create a new instance of link:{webclient-javadoc-base-url}.api/io/helidon/webclient/api/HttpClientRequest.html[HttpClientRequest] which can then be configured to add optional settings that will customize the behavior of the request. +Check out link:{webclient-javadoc-base-url}.api/io/helidon/webclient/api/HttpClient.html[HttpClient] API to learn more about request methods. These methods will create a new instance of link:{webclient-javadoc-base-url}.api/io/helidon/webclient/api/HttpClientRequest.html[HttpClientRequest] which can then be configured to add optional settings that will customize the behavior of the request. === Customizing the Request @@ -147,8 +147,8 @@ ClientResponseTyped response = webClient.get() String entityString = response.entity(); ---- -=== Protocol used -Webclient currently supports `HTTP/1.1` and `HTTP/2` protocols. Below are the rules on which specific protocol will be used: +=== Protocol Used +WebClient currently supports `HTTP/1.1` and `HTTP/2` protocols. Below are the rules on which specific protocol will be used: * Using plain socket triggers WebClient to process a request using `HTTP/1.1`. * When using TLS, the client will use ALPN (protocol negotiation) to use appropriate HTTP version (either 1.1, or 2). `HTTP/2` has a higher weight, so it is chosen if supported by both sides. @@ -162,7 +162,7 @@ String result = webClient.get() * If `HTTP/2` is used, an upgrade attempt will be performed. If it fails, the client falls-back to `HTTP/1.1`. * The parameter `prior-knowledge` can be defined using `HTTP/2` protocol configuration. Please refer to <> on how to customize `HTTP/2`. In such a case, `prior-knowledge` will be used and fail if it is unable to switch to `HTTP/2`. -=== Adding Media Support to the WebClient +=== Adding Media Support Webclient supports the following built-in Helidon Media Support libraries: @@ -237,9 +237,6 @@ Webclient provides three DNS resolver implementations out of the box: ---- -=== Adding Service - - == Configuring the WebClient The class responsible for WebClient configuration is: @@ -385,8 +382,7 @@ Config config = Config.create(); WebClient webClient = WebClient.create(config.get("webclient")); ---- - -=== WebClient TLS setup +=== WebClient TLS Setup Configure TLS either programmatically or by the Helidon configuration framework. @@ -423,7 +419,10 @@ webclient: resource: resource-path: "client.p12" ---- -Then, in your application code, load the configuration from that file. + +NOTE: The `passphrase` value on the config file can be encrypted if stronger security is required. For more information on how secrets can be encrypted using a master password and store them in a configuration file, please see xref:{rootdir}/mp/security/configuration-secrets.adoc[Configuration Secrets]. + +In the application code, load the settings from the configuration file. [source,java] .WebClient initialization using the `application.yaml` file located on the classpath