admin管理员组

文章数量:1406033

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.

本文标签: streamingHow send as chunk POST a multipart with WebClient in SpringStack Overflow