Zufar Muhamadeev :
At backend side I have REST controller with POST method:
@RequestMapping(value = "/save", method = RequestMethod.POST)
public Integer save(@RequestParam String name) {
//do save
return 0;
}
How can i create request using WebClient with request parameter?
WebClient.create(url).post()
.uri("/save")
//?
.exchange()
.block()
.bodyToMono(Integer.class)
.block();
Brian Clozel :
There are many encoding challenges when it comes to creating URIs. For more flexibility while still being right on the encoding part, WebClient
provides a builder-based variant for the URI:
WebClient.create().get()
.uri(builder -> builder.scheme("http")
.host("example.org").path("save")
.queryParam("name", "spring-framework")
.build())
.retrieve()
.bodyToMono(String.class);
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=435000&siteId=1