public static <T, P extends Publisher<T>> Mono<Void> writeWith(final ClientResponse clientResponse,
                                                                   final ServerWebExchange exchange,
                                                                   final P publisher,
                                                                   final Class<T> elementClass) {
        BodyInserter<P, ReactiveHttpOutputMessage> bodyInserter = BodyInserters.fromPublisher(publisher, elementClass);
        CachedBodyOutputMessage outputMessage = ResponseUtils.newCachedBodyOutputMessage(exchange);
        return bodyInserter.insert(outputMessage, new BodyInserterContext()).then(Mono.defer(() -> {
            Mono<DataBuffer> messageBody = ResponseUtils.fixBodyMessage(exchange.getResponse(), outputMessage);
            exchange.getAttributes().put(Constants.CLIENT_RESPONSE_ATTR, clientResponse);
            return exchange.getResponse().writeWith(messageBody);
        })).onErrorResume((Function<Throwable, Mono<Void>>) throwable -> ResponseUtils.release(outputMessage, throwable));
    }
the response write with data.

@param clientResponse the client response
@param exchange the exchange
@param publisher the publisher
@param elementClass the elementClass
@param <T> the element type
@param <P> the publishing type
@return the response wrapper data
shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/utils/ResponseUtils.java