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

Spring MVC Servlet with WebClient and OAuth Client Credentials

I am using WebClient in Spring MVC servlet based application (non-reactive) for accessing resources over HTTP from other microservices. Few of the resources are protected by client_credentials OAuth2 flow. It is very convenient to configure…
Munish Chandel
  • 3,572
  • 3
  • 24
  • 35
0
votes
1 answer

How can I change DEFAULT_CONNECT_TIMEOUT_MILLIS while configuring Spring WebClient proxy?

I am trying to configure WebClient with proxy the next way (kotlin): private fun WebClient.Builder.securedHttpConnector( host: String, port: Int, sslContextBuilder: SslContextBuilder ) = apply { clientConnector( …
0
votes
0 answers

How to publish data in Spring webflux hierarchy?

I'm developing a proxy application with spring webflux. The client sends a request to fetch first 100 records. The server 1(Spring webflux project) sends a request to server 2, and fetch first 100 records(Flux) and then applies a filter on…
Morteza Malvandi
  • 1,656
  • 7
  • 30
  • 73
0
votes
1 answer

Spring 5's Reactive WebClient not so asyncronous?

I met strange Spring WebClient's behavior. I have two URLs, slow and fast. Bot do nothing, but slow just wait ten seconds before response. When i call them simultaneously using WebClient, i expect fast URL will be completed earlier than slow, but…
Alexey Sviridov
  • 3,360
  • 28
  • 33
0
votes
1 answer

How to deserialize request multipart body from string

I have a string representing a multipart/form-data body of a request and I want to parse it in order to write a unit test with assertions for its values. I'm using spring MultipartBodyBuilder for building the body of the request. Then I want to have…
Yaniv
  • 144
  • 1
  • 11
0
votes
1 answer

Adding Codec to Add Content-Length in my Requests in WebClient

I want to add some sort of ChannelOutboundHandler to my WebClient that takes the request, add the 'Content-Length' header to it, and forwards it. I know that the class HttpContentEncoder does this. How do I configure this class in my WebClient?
Prashant Pandey
  • 4,332
  • 3
  • 26
  • 44
0
votes
0 answers

Spring WebFlux : WebClient + Fallback on error

I want to set up a fallback when my program works if the first service is unavailable. On the second service, I use WebClient which accesses the first service and receives data from it. I made two options but they do not work for me. If both…
Kirill Sereda
  • 469
  • 1
  • 10
  • 25
0
votes
1 answer

WebClient - dealing with XSRF/CSRF tokens

I'm trying to connect to API with CSRF protection using WebClient. How ExchangeFilterFunction could look like to handle XSRF-TOKEN cookie and include X-XSRF-TOKEN header?
Krzysztof Skrzynecki
  • 2,345
  • 27
  • 39
0
votes
0 answers

I am getting an SSL Exception - " java.security.cert.CertificateException: No subject alternative names matching IP address X.X.X.X found "

I am having microservices in spring boot and using WebClient builder for different API to API call when I use @LoadBalanced in my application I am getting an SSL Exception - " java.security.cert.CertificateException: No subject alternative names…
0
votes
1 answer

Spring WebFlux and WebClient change response on error

I have some controller method like @PostMapping("/*") fun proxy(@RequestBody body: String): Mono { return roundRobinBean.getNext() .post() .uri("/api") .body(BodyInserters.fromObject(body)) …
Igor Fedorov
  • 321
  • 3
  • 17
0
votes
1 answer

How to unit test a class that makes an external WebClient request?

I have an @Service class that does some null checks and then makes a call to an external micro-service using WebClient. Sonar is complaining that this class is not test because the method is not fully tested. Question is, how can I mock this call or…
0
votes
1 answer

How to intercept http response traffic in Spring WebClient / DataBuffer?

How can I intercept WebClient XML responses before they are converted from bytes to DTO? I tried adding an exchangeStrategy, but how could I convert DataBuffer to String, and afterwards still invoke the super.decode()…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
0
votes
1 answer

How to intercept http traffic in Spring WebClient?

How can I intercept WebFilter requests after they have been converted from DTO to JSON String? Of course I could add a ExchangeFilterFunction, but the clientRequest.body() only shows my input object, not the converted json…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
0
votes
0 answers

RestTemplate getForObject worked fine for few hours and then threw 400 bad request which eventually changed to 494 UnsupportedHttpStatusCodeException

I am trying to access a static json using getForObject method. It worked fine for 14 hours and then started throwing 400 Bad Request. After another 24 hours, it started to throw UnsupportedHttpStatusCodeException [494] null. We use aws ec2 instance…
0
votes
1 answer

Retrieve webclient response - Spring Cloud

I'm using spring cloud to request data from another service. So, basically I request data and I want to retrieve that data and assigns it to another object which will be the one I'll save. This is my code: public Mono save(Shops shops) { …
lak
  • 454
  • 6
  • 21