-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHttp2Client.java
More file actions
30 lines (25 loc) · 835 Bytes
/
Http2Client.java
File metadata and controls
30 lines (25 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.test.hgw;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.ClientResponse;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
/**
* Http2 the client.
*
* @author dor
*/
public class Http2Client {
private WebClient client = WebClient.create("https://localhost:8443");
enum Color {
Blue, Red, Black
}
private Mono<ClientResponse> result = client.get()
.uri("/test")
.accept(MediaType.TEXT_PLAIN)
.exchange();
public String getResult() {
Color myColor = Color.Blue;
a () -> System.out.println("Hello World! my Color ="+myColor);
return ">> result = " + result.flatMap(res -> res.bodyToMono(String.class)).block();
}
}