Questions tagged [spring-webclient]

WebClient makes it possible to perform reactive non-blocking HTTP requests in Spring applications. Use this tag for any questions involving its usage.

992 questions
0
votes
1 answer

Multiple Mono and common subscriber

I am a newbie to reactive programming in Java. I plan to use spring-webclient instead of restclient as the latter is being decommissioned. I have a situation when I make several http post requests to different endpoints and the response structure is…
Winster
  • 943
  • 10
  • 28
0
votes
1 answer

How to set password grant credentials for OAuth 2.0?

I am trying to set a Spring WebClient instance to use OAuth 2.0 authentication with the password grant type, but I am not sure about how to properly set the username and the password. In my application, the relevant parameters are received in the…
Guimo
  • 632
  • 1
  • 7
  • 15
0
votes
0 answers

Advice on passing HTTP Headers in a thread safe manner

Desired behaviour: There is a Spring Boot Application that has a Controller which hosts an endpoint which will retrieve data (via HTTP call) through a separate service. However, it will need to pass along the Bearer token from the original headers…
C Chow
  • 3
  • 2
0
votes
1 answer

Rest Service Post Calls Not working with Spring Webclient

I need to invoke a rest service asynchronously and I thought of using spring reactive's webclient instead of the AsyncRestTemplate. However my url is not getting invoked at all with the below code. Mono asyncResponse =…
0
votes
1 answer

How to achieve same functionality as retry with repeatWhen or repeatWhenEmpty operator while combining with webClient

The retry-logic is implemented in WebClientConfig.ExchangeFilterFunction. I would like to implement similar with repeatWhenEmpty operator. Uses: Java 1.8 Spring Boot Version 2.1X Project Reactor Addons 3.1.6 Configuration:…
gkc123
  • 512
  • 1
  • 7
  • 24
0
votes
0 answers

Read Large JSON response using WebClient or RestTemplate in one shot

I am facing issue while reading large JSON data (>100MB) using webClient in one shot (Chunks/pagination is not supported from Client end). Also I tried using restTemplate but no luck. WebClient code: public List fetchPhoneDetails(PhoneRequest…
Thej
  • 191
  • 1
  • 6
  • 23
0
votes
3 answers

adding JWT token in request in reactive way in webflux

I am using WebClient to call Rest API Which are secured by JWT token. //To get Token JwtToken token = client.post() .uri("") .body(BodyInserters.fromFormData("username", "XXX") …
Niraj Sonawane
  • 10,225
  • 10
  • 75
  • 104
0
votes
1 answer

Spring Boot Webclient metrics missing in prometheus endpoint

Http client metrics in Prometheus endpoint is missing while creating the WebClient Manually. Below code is able to generate the expected http client metrics as shown below, @Autowired WebClient.Builder webClientBuilder; @GetMapping("client") public…
Aravindhan
  • 3,566
  • 7
  • 26
  • 42
0
votes
1 answer

Spring WebFlux Proxy a Request to Another Server using WebClient CodecException: No suitable writer found for part: zip

I am trying to proxy a request to another server. I am using Spring web flux and I have an object of type org.springframework.web.reactive.function.server.ServerRequest that I extract the multipart/form-data body received from using…
0
votes
1 answer

Reactive Spring WebClient calls

I am trying to understand WebFlux but having some trouble with Webclient calls. I do not see this line System.out.println("customerId = " + customerId); executes it seems like it does not call the endpoint. But if I subscribe to webclient with…
0
votes
1 answer

Spring Framework WebFlux Reactive Programming

I am trying to send an object to the endpoint but I do not understand why I can't do it with .get(), why .post() has to be used? What if the endpoint method takes an object and does something with it and returns an object? I may want to send an…
Lisa
  • 129
  • 1
  • 1
  • 8
0
votes
1 answer

WebClient proxy configuration not working with oAuth2

I have implemented webclient and oAuth2 with grant type Client Credentials. I must use proxy to access bureau. But webclient is not using the host which I have configured. HttpClient httpClient = HttpClient.create() .tcpConfiguration(tcpClient ->…
0
votes
1 answer

Better way to poll spring boot actuator endpoint (stream it instead of polling?)

I am programming a web UI that monitors another Java application in Spring Boot, supported by Spring Actuator. Right now I can poll Spring Actuator's endpoints from the other client Sprint Boot web application using a regular Get request (via Spring…
0
votes
0 answers

Why webClient doesn't do any http call?

I have following code: List> monoList = queue.stream() .map(jobStatusBunch -> webClient .post() .uri("localhost:8080/api/some/url") …
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
0
votes
2 answers

How to call several http requests in parallel(with retry functionality) and await when all of them are finish?

For now my code looks like this: List>> response = queue.stream() .map(req-> webClient .post() .bodyValue(req) .retrieve() …
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710