Formatting for 3.1.x
This commit is contained in:
@@ -24,6 +24,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
* Contract to allow a {@link GatewayFilter} to delegate to the next in the chain.
|
||||
*
|
||||
* Copied from framework WebFilterChain
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
*/
|
||||
|
||||
@@ -21,13 +21,14 @@ import reactor.core.publisher.Mono;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
/**
|
||||
* Contract for interception-style, chained processing of gateway requests that may be used to
|
||||
* implement cross-cutting, application-agnostic requirements such as security, timeouts,
|
||||
* and others.
|
||||
* Contract for interception-style, chained processing of gateway requests that may be
|
||||
* used to implement cross-cutting, application-agnostic requirements such as security,
|
||||
* timeouts, and others.
|
||||
*
|
||||
* Only applies to matched gateway routes.
|
||||
*
|
||||
* Copied from framework WebFilter
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 5.0
|
||||
*/
|
||||
|
||||
@@ -89,8 +89,8 @@ public class CacheRequestBodyGatewayFilterFactory
|
||||
//
|
||||
Object backupCachedBody = exchange.getAttributes()
|
||||
.get(CACHED_ORIGINAL_REQUEST_BODY_BACKUP_ATTR);
|
||||
if (backupCachedBody instanceof DataBuffer backupCachedDataBuffer) {
|
||||
DataBufferUtils.release(backupCachedDataBuffer);
|
||||
if (backupCachedBody instanceof DataBuffer) {
|
||||
DataBufferUtils.release((DataBuffer) backupCachedBody);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -174,8 +174,9 @@ public class CacheRequestBodyGatewayFilterFactoryTests extends BaseWebClientTest
|
||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||
return chain.filter(exchange).doAfterTerminate(() -> {
|
||||
Object o = exchange.getAttributes()
|
||||
.get(CacheRequestBodyGatewayFilterFactory.CACHED_ORIGIN_REQUEST_BODY_BACKUP_ATTR);
|
||||
if (o instanceof PooledDataBuffer dataBuffer) {
|
||||
.get(CacheRequestBodyGatewayFilterFactory.CACHED_ORIGINAL_REQUEST_BODY_BACKUP_ATTR);
|
||||
if (o instanceof PooledDataBuffer) {
|
||||
PooledDataBuffer dataBuffer = (PooledDataBuffer) o;
|
||||
if (dataBuffer.isAllocated()) {
|
||||
exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
fail("DataBuffer is not released");
|
||||
|
||||
Reference in New Issue
Block a user