streaming - How send as chunk POST a multipart with WebClient in Spring - Stack Overflow

Flux<DataBuffer> dataBufferFlux = DataBufferUtils.read(path, new DefaultDataBufferFactory(), 4096

Flux<DataBuffer> dataBufferFlux = DataBufferUtils.read(path, new DefaultDataBufferFactory(), 4096);

Message message = new Message();
    message.setText(body);
    message.setSubject(subject);
    message.setHtml(true);
    message.setFrom(from);
    message.setTo(to);

MultipartBodyBuilder builder = new MultipartBodyBuilder();
builder.asyncPart("attachments", dataBufferFlux, DataBuffer.class)
   .header("Content-Disposition", "form-data; name=attachments; filename=" + fileName);
builder.part("message", message, MediaType.APPLICATION_JSON);

scaMail.post()
            .uri("https://some-url/mail/send")
            .contentType(MediaType.MULTIPART_FORM_DATA)
            .bodyValue(builder.build())
            .retrieve().bodyToMono(String.class)
            .timeout(Duration.ofMillis(30000))
            .subscribe(response -> System.out.println("Response: " + response));

I'd like sending via WebClient in Spring Boot 3.4 a multipart streamed in chunk request. But it is send in one request and not chunk requests, I have not found how to do this.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744966126a4603690.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信