Skip to content

Commit

Permalink
Update doc related with HTTP/2
Browse files Browse the repository at this point in the history
Signed-off-by: raccoonback <[email protected]>
  • Loading branch information
raccoonback committed Feb 2, 2025
1 parent 0e59863 commit dfe7f25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/modules/ROOT/pages/http-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ include::{examples-dir}/http2/H2Application.java[lines=18..42]
----
<1> Configures the client to support only `HTTP/2`
<2> Configures `SSL`
<3> You can configure the interval for checking `Ping` frames

The following listing presents a simple `H2C` example:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2020-2025 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,13 +21,16 @@
import reactor.netty.http.client.HttpClient;
import reactor.util.function.Tuple2;

import java.time.Duration;

public class H2Application {

public static void main(String[] args) {
HttpClient client =
HttpClient.create()
.protocol(HttpProtocol.H2) //<1>
.secure(); //<2>
.secure() //<2>
.http2Settings(builder -> builder.pingInterval(Duration.ofMillis(100))); // <3>

Tuple2<String, HttpHeaders> response =
client.get()
Expand Down

0 comments on commit dfe7f25

Please sign in to comment.