Example usage for org.springframework.http.server.reactive ServerHttpResponse isCommitted

List of usage examples for org.springframework.http.server.reactive ServerHttpResponse isCommitted

Introduction

In this page you can find the example usage for org.springframework.http.server.reactive ServerHttpResponse isCommitted.

Prototype

boolean isCommitted();

Source Link

Document

Whether the HttpOutputMessage is committed.

Usage

From source file:org.springframework.cloud.gateway.filter.GatewayMetricsFilter.java

private void endTimerRespectingCommit(ServerWebExchange exchange, Sample sample) {

    ServerHttpResponse response = exchange.getResponse();
    if (response.isCommitted()) {
        endTimerInner(exchange, sample);
    } else {/*  w ww. j ava2s . co m*/
        response.beforeCommit(() -> {
            endTimerInner(exchange, sample);
            return Mono.empty();
        });
    }
}