0

I am working with Spring WebClient and need to download list of files from API.

class Document {
   private String content;
   private String fileName;
}

Following is the structure of single document and I need to fetch list of documents. So now the problem is size. if document size is large than 2 mb application throws exception.

So I want to use file system to solve this. Currently i am using following piece of code to get all docs.

public Documents getDoc() {
        WebClient webClient = webClientCreator.createWebClient();
        return webClient
                .get()
                .uri(getTestURI())
                .header(HttpHeaders.ACCEPT, Constants.ACCEPT_TYPE)
                .retrieve()
                .bodyToMono(Documents.class)
                .block();
    }

How can I use file system to write file temporally there.

keepmoving
  • 1,813
  • 8
  • 34
  • 74
  • Why aren't you just returning a `Flux` of `Document` instances, this you can then process on the fly instead of using `block` to retrieve everything and process everything in one go. Basically beats the purpose of using `Webclient`. – M. Deinum Jun 08 '21 at 09:16
  • Even though its single file. still it does not work and through limit exceeded error. – keepmoving Jun 08 '21 at 09:30

0 Answers0