Expose BodyInserter in EntityResponse
This commit is contained in:
parent
44ec6e0037
commit
dff9b3b85c
|
|
@ -196,6 +196,11 @@ class DefaultEntityResponseBuilder<T> implements EntityResponse.Builder<T> {
|
|||
return this.entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BodyInserter<T, ? super ServerHttpResponse> inserter() {
|
||||
return this.inserter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Void> writeTo(ServerWebExchange exchange, HandlerStrategies strategies) {
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ import org.springframework.http.HttpMethod;
|
|||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.codec.json.AbstractJackson2Codec;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.web.reactive.function.BodyInserter;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
|
||||
/**
|
||||
|
|
@ -45,6 +47,11 @@ public interface EntityResponse<T> extends ServerResponse {
|
|||
*/
|
||||
T entity();
|
||||
|
||||
/**
|
||||
* Return the {@code BodyInserter} that writes the entity to the output stream.
|
||||
*/
|
||||
BodyInserter<T, ? super ServerHttpResponse> inserter();
|
||||
|
||||
// Static builder methods
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue