Merge branch 'master' of github.com:spring-cloud/spring-cloud-gateway
This commit is contained in:
@@ -19,6 +19,10 @@ package org.springframework.cloud.gateway.filter.factory;
|
||||
|
||||
import org.springframework.cloud.gateway.support.AbstractConfigurable;
|
||||
|
||||
/**
|
||||
* This class is BETA and may be subject to change in a future release.
|
||||
* @param <C>
|
||||
*/
|
||||
public abstract class AbstractGatewayFilterFactory<C>
|
||||
extends AbstractConfigurable<C> implements GatewayFilterFactory<C> {
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import reactor.core.publisher.Mono;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* This class is BETA and may be subject to change in a future release.
|
||||
* Response who's job it is to gather the Publisher<DataBuffer> from the writeWith message
|
||||
* during a call to HttpMessageWriter.write. Also gathers any headers set there.
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,9 @@ import org.springframework.http.server.reactive.ServerHttpRequestDecorator;
|
||||
|
||||
import static org.springframework.cloud.gateway.filter.factory.rewrite.RewriteUtils.process;
|
||||
|
||||
/**
|
||||
* This filter is BETA and may be subject to change in a future release.
|
||||
*/
|
||||
public class ModifyRequestBodyGatewayFilterFactory
|
||||
extends AbstractGatewayFilterFactory<ModifyRequestBodyGatewayFilterFactory.Config> {
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
import static org.springframework.cloud.gateway.filter.factory.rewrite.RewriteUtils.getHttpMessageReader;
|
||||
import static org.springframework.cloud.gateway.filter.factory.rewrite.RewriteUtils.getHttpMessageWriter;
|
||||
|
||||
/**
|
||||
* This filter is BETA and may be subject to change in a future release.
|
||||
*/
|
||||
public class ModifyResponseBodyGatewayFilterFactory
|
||||
extends AbstractGatewayFilterFactory<ModifyResponseBodyGatewayFilterFactory.Config> {
|
||||
|
||||
|
||||
@@ -21,5 +21,10 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/**
|
||||
* This interface is BETA and may be subject to change in a future release.
|
||||
* @param <T>
|
||||
* @param <R>
|
||||
*/
|
||||
public interface RewriteFunction<T, R> extends BiFunction<ServerWebExchange, T, R> {
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ import org.springframework.http.codec.CodecConfigurer;
|
||||
import org.springframework.http.codec.HttpMessageReader;
|
||||
import org.springframework.http.codec.HttpMessageWriter;
|
||||
|
||||
/**
|
||||
* This class is BETA and may be subject to change in a future release.
|
||||
*/
|
||||
public abstract class RewriteUtils {
|
||||
|
||||
public static <T, R> R process(Mono<T> mono, Function<T, R> consumer) {
|
||||
|
||||
@@ -37,6 +37,9 @@ import static org.springframework.cloud.gateway.filter.factory.rewrite.RewriteUt
|
||||
import static org.springframework.cloud.gateway.filter.factory.rewrite.RewriteUtils.getHttpMessageWriter;
|
||||
import static org.springframework.cloud.gateway.filter.factory.rewrite.RewriteUtils.process;
|
||||
|
||||
/**
|
||||
* This predicate is BETA and may be subject to change in a future release.
|
||||
*/
|
||||
public class ReadBodyPredicateFactory extends AbstractRoutePredicateFactory<ReadBodyPredicateFactory.Config> {
|
||||
|
||||
private final ServerCodecConfigurer codecConfigurer;
|
||||
|
||||
@@ -175,6 +175,7 @@ public class GatewayFilterSpec extends UriSpec {
|
||||
|
||||
/**
|
||||
* A filter that can be used to modify the request body.
|
||||
* This filter is BETA and may be subject to change in a future release.
|
||||
* @param inClass the class to convert the incoming request body to
|
||||
* @param outClass the class the Gateway will add to the request before it is routed
|
||||
* @param rewriteFunction the {@link RewriteFunction} that transforms the request body
|
||||
@@ -189,6 +190,7 @@ public class GatewayFilterSpec extends UriSpec {
|
||||
|
||||
/**
|
||||
* A filter that can be used to modify the response body
|
||||
* This filter is BETA and may be subject to change in a future release.
|
||||
* @param inClass the class to conver the response body to
|
||||
* @param outClass the class the Gateway will add to the response before it is returned to the client
|
||||
* @param rewriteFunction the {@link RewriteFunction} that transforms the response body
|
||||
|
||||
@@ -170,6 +170,7 @@ public class PredicateSpec extends UriSpec {
|
||||
}
|
||||
|
||||
/**
|
||||
* This predicate is BETA and may be subject to change in a future release.
|
||||
* A predicate that checks the contents of the request body
|
||||
* @param inClass the class to parse the body to
|
||||
* @param predicate a predicate to check the contents of the body
|
||||
|
||||
Reference in New Issue
Block a user