public class ResponseBodyCapture
extends org.springframework.http.server.reactive.ServerHttpResponseDecorator
Installed by BusiLogResponseCaptureFilter (WebFilter) BEFORE the ShenYu plugin chain.
This ensures that when the response plugin (order=420) writes the body, it goes through this
decorator. BusiLogPlugin (order=1050) registers a callback via exchange attribute; the callback
is triggered from writeWith(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>) when the body is actually written.
If no callback is registered (request doesn't match busiLog rules), writeWith() passes through without any buffering overhead.
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
CALLBACK_ATTR
Exchange attribute key: stores a Runnable callback to invoke after body is captured.
|
static java.lang.String |
CAPTURE_ATTR
Exchange attribute key: stores the ResponseBodyCapture instance.
|
| 构造器和说明 |
|---|
ResponseBodyCapture(org.springframework.http.server.reactive.ServerHttpResponse delegate,
org.springframework.web.server.ServerWebExchange exchange)
Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
java.lang.String |
getCapturedBody()
Get the captured response body as string.
|
org.springframework.http.HttpStatus |
getCapturedStatus()
Get the captured HTTP status code.
|
reactor.core.publisher.Mono<java.lang.Void> |
writeAndFlushWith(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>> body) |
reactor.core.publisher.Mono<java.lang.Void> |
writeWith(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer> body) |
public static final java.lang.String CAPTURE_ATTR
public static final java.lang.String CALLBACK_ATTR
public ResponseBodyCapture(org.springframework.http.server.reactive.ServerHttpResponse delegate,
org.springframework.web.server.ServerWebExchange exchange)
delegate - the original ServerHttpResponseexchange - the server web exchange (for reading callback attribute)public reactor.core.publisher.Mono<java.lang.Void> writeWith(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer> body)
writeWith 在接口中 org.springframework.http.ReactiveHttpOutputMessagewriteWith 在类中 org.springframework.http.server.reactive.ServerHttpResponseDecoratorpublic reactor.core.publisher.Mono<java.lang.Void> writeAndFlushWith(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>> body)
writeAndFlushWith 在接口中 org.springframework.http.ReactiveHttpOutputMessagewriteAndFlushWith 在类中 org.springframework.http.server.reactive.ServerHttpResponseDecoratorpublic java.lang.String getCapturedBody()
public org.springframework.http.HttpStatus getCapturedStatus()
Copyright © 2026 The Apache Software Foundation. All rights reserved.