Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6456 webclient doc part2 4.x #7845

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions docs/se/webclient.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -147,8 +147,8 @@ ClientResponseTyped<String> 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.
Expand All @@ -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 <<Setting Protocol configuration>> 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:

Expand Down Expand Up @@ -237,9 +237,6 @@ Webclient provides three DNS resolver implementations out of the box:
</dependency>
----

=== Adding Service


== Configuring the WebClient

The class responsible for WebClient configuration is:
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down