Class GatewayFilterSpec
- java.lang.Object
-
- org.springframework.cloud.gateway.route.builder.UriSpec
-
- org.springframework.cloud.gateway.route.builder.GatewayFilterSpec
-
public class GatewayFilterSpec extends UriSpec
Applies specific filters to routes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classGatewayFilterSpec.RequestRateLimiterSpec
-
Constructor Summary
Constructors Constructor Description GatewayFilterSpec(Route.AsyncBuilder routeBuilder, RouteLocatorBuilder.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GatewayFilterSpecaddRequestHeader(String headerName, String headerValue)Adds a request header to the request before it is routed by the Gateway.GatewayFilterSpecaddRequestParameter(String param, String value)Adds a request parameter to the request before it is routed by the Gateway.GatewayFilterSpecaddResponseHeader(String headerName, String headerValue)Adds a header to the response returned to the Gateway from the route.GatewayFilterSpeccacheRequestBody(Class<?> bodyClass)A filter that can cache the request body.GatewayFilterSpecchangeRequestUri(Function<org.springframework.web.server.ServerWebExchange,Optional<URI>> determineRequestUri)A filter which change the URI the request will be routed to by the Gateway.GatewayFilterSpeccircuitBreaker(Consumer<SpringCloudCircuitBreakerFilterFactory.Config> configConsumer)GatewayFilterSpecdedupeResponseHeader(String headerName, String strategy)A filter that removes duplication on a response header before it is returned to the client by the Gateway.GatewayFilterSpecfallbackHeaders(Consumer<FallbackHeadersGatewayFilterFactory.Config> configConsumer)Adds hystrix execution exception headers to fallback request.GatewayFilterSpecfallbackHeaders(FallbackHeadersGatewayFilterFactory.Config config)Adds hystrix execution exception headers to fallback request.GatewayFilterSpecfilter(GatewayFilter gatewayFilter)Applies the filter to the route.GatewayFilterSpecfilter(GatewayFilter gatewayFilter, int order)Applies the filter to the route.GatewayFilterSpecfilters(Collection<GatewayFilter> gatewayFilters)Applies the list of filters to the route.GatewayFilterSpecfilters(GatewayFilter... gatewayFilters)Applies the list of filters to the route.GatewayFilterSpecjsonToGRPC(String protoDescriptor, String protoFile, String service, String method)A filter that transforms a JSON request into a gRPC one.GatewayFilterSpecmapRequestHeader(String fromHeader, String toHeader)Maps headers from one name to another.<T,R>
GatewayFilterSpecmodifyRequestBody(Class<T> inClass, Class<R> outClass, String newContentType, RewriteFunction<T,R> rewriteFunction)A filter that can be used to modify the request body.<T,R>
GatewayFilterSpecmodifyRequestBody(Class<T> inClass, Class<R> outClass, RewriteFunction<T,R> rewriteFunction)A filter that can be used to modify the request body.<T,R>
GatewayFilterSpecmodifyRequestBody(Consumer<ModifyRequestBodyGatewayFilterFactory.Config> configConsumer)A filter that can be used to modify the request body.<T,R>
GatewayFilterSpecmodifyResponseBody(Class<T> inClass, Class<R> outClass, String newContentType, RewriteFunction<T,R> rewriteFunction)A filter that can be used to modify the response body.<T,R>
GatewayFilterSpecmodifyResponseBody(Class<T> inClass, Class<R> outClass, RewriteFunction<T,R> rewriteFunction)A filter that can be used to modify the response body.<T,R>
GatewayFilterSpecmodifyResponseBody(Consumer<ModifyResponseBodyGatewayFilterFactory.Config> configConsumer)A filter that can be used to modify the response body using custom spec.GatewayFilterSpecprefixPath(String prefix)A filter that can be used to add a prefix to the path of a request before it is routed by the Gateway.GatewayFilterSpecpreserveHostHeader()A filter that will preserve the host header of the request on the outgoing request from the Gateway.GatewayFilterSpecredirect(int status, String url)A filter that will return a redirect response back to the client.GatewayFilterSpecredirect(int status, URI url)A filter that will return a redirect response back to the client.GatewayFilterSpecredirect(String status, String url)A filter that will return a redirect response back to the client.GatewayFilterSpecredirect(String status, URI url)A filter that will return a redirect response back to the client.GatewayFilterSpecredirect(org.springframework.http.HttpStatus status, URL url)A filter that will return a redirect response back to the client.GatewayFilterSpecremoveRequestHeader(String headerName)A filter that will remove a request header before the request is routed by the Gateway.GatewayFilterSpecremoveRequestParameter(String paramName)A filter that will remove a request param before the request is routed by the Gateway.GatewayFilterSpecremoveResponseHeader(String headerName)A filter that will remove a response header before the Gateway returns the response to the client.GatewayFilterSpecrequestHeaderToRequestUri(String headerName)A filter which changes the URI the request will be routed to by the Gateway by pulling it from a header on the request.GatewayFilterSpec.RequestRateLimiterSpecrequestRateLimiter()A filter that will set up a request rate limiter for a route.GatewayFilterSpecrequestRateLimiter(Consumer<RequestRateLimiterGatewayFilterFactory.Config> configConsumer)A filter that will set up a request rate limiter for a route.GatewayFilterSpecretry(int retries)A filter that will retry failed requests.GatewayFilterSpecretry(Consumer<RetryGatewayFilterFactory.RetryConfig> retryConsumer)A filter that will retry failed requests.GatewayFilterSpecretry(reactor.retry.Repeat<org.springframework.web.server.ServerWebExchange> repeat, reactor.retry.Retry<org.springframework.web.server.ServerWebExchange> retry)A filter that will retry failed requests.GatewayFilterSpecrewriteLocationResponseHeader(String stripVersionMode, String locationHeaderName, String hostValue, String protocolsRegex)A filter that rewrites the value of Location response header, ridding it of backend specific details.GatewayFilterSpecrewritePath(String regex, String replacement)A filter which rewrites the request path before it is routed by the Gateway.GatewayFilterSpecrewriteResponseHeader(String headerName, String regex, String replacement)A filter that rewrites a header value on the response before it is returned to the client by the Gateway.GatewayFilterSpecsaveSession()A filter which forces aWebSession::saveoperation before forwarding the call downstream.GatewayFilterSpecsecureHeaders()A filter that adds a number of headers to the response at the reccomendation from this blog post.GatewayFilterSpecsecureHeaders(Consumer<SecureHeadersGatewayFilterFactory.Config> configConsumer)A filter that adds a number of headers to the response at the reccomendation from this blog post.GatewayFilterSpecsetHostHeader(String hostName)A filter that will set the Host header to {@param hostName} on the outgoing request.GatewayFilterSpecsetPath(String template)A filter that sets the path of the request before it is routed by the Gateway.GatewayFilterSpecsetRequestHeader(String headerName, String headerValue)A filter that sets a header on the request before it is routed by the Gateway.GatewayFilterSpecsetRequestHeaderSize(org.springframework.util.unit.DataSize size)A filter that sets the maximum permissible size of headers of Request.GatewayFilterSpecsetRequestSize(Long size)A filter that sets the maximum permissible size of a Request.GatewayFilterSpecsetRequestSize(org.springframework.util.unit.DataSize size)A filter that sets the maximum permissible size of a Request.GatewayFilterSpecsetResponseHeader(String headerName, String headerValue)A filter that sets a header on the response before it is returned to the client by the Gateway.GatewayFilterSpecsetStatus(int status)A filter that sets the status on the response before it is returned to the client by the Gateway.GatewayFilterSpecsetStatus(String status)A filter that sets the status on the response before it is returned to the client by the Gateway.GatewayFilterSpecsetStatus(org.springframework.http.HttpStatus status)A filter that sets the status on the response before it is returned to the client by the Gateway.GatewayFilterSpecstripPrefix(int parts)Strips the prefix from the path of the request before it is routed by the Gateway.GatewayFilterSpectokenRelay()A filter that enables token relay.List<GatewayFilter>transformToOrderedFilters(Stream<GatewayFilter> stream)
-
-
-
Constructor Detail
-
GatewayFilterSpec
public GatewayFilterSpec(Route.AsyncBuilder routeBuilder, RouteLocatorBuilder.Builder builder)
-
-
Method Detail
-
filter
public GatewayFilterSpec filter(GatewayFilter gatewayFilter)
Applies the filter to the route.- Parameters:
gatewayFilter- the filter to apply- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
filter
public GatewayFilterSpec filter(GatewayFilter gatewayFilter, int order)
Applies the filter to the route.- Parameters:
gatewayFilter- the filter to applyorder- the order to apply the filter- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
filters
public GatewayFilterSpec filters(GatewayFilter... gatewayFilters)
Applies the list of filters to the route.- Parameters:
gatewayFilters- the filters to apply- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
transformToOrderedFilters
public List<GatewayFilter> transformToOrderedFilters(Stream<GatewayFilter> stream)
-
filters
public GatewayFilterSpec filters(Collection<GatewayFilter> gatewayFilters)
Applies the list of filters to the route.- Parameters:
gatewayFilters- the filters to apply- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
addRequestHeader
public GatewayFilterSpec addRequestHeader(String headerName, String headerValue)
Adds a request header to the request before it is routed by the Gateway.- Parameters:
headerName- the header nameheaderValue- the header value- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
addRequestParameter
public GatewayFilterSpec addRequestParameter(String param, String value)
Adds a request parameter to the request before it is routed by the Gateway.- Parameters:
param- the parameter namevalue- the parameter vaule- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
addResponseHeader
public GatewayFilterSpec addResponseHeader(String headerName, String headerValue)
Adds a header to the response returned to the Gateway from the route.- Parameters:
headerName- the header nameheaderValue- the header value- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
dedupeResponseHeader
public GatewayFilterSpec dedupeResponseHeader(String headerName, String strategy)
A filter that removes duplication on a response header before it is returned to the client by the Gateway.- Parameters:
headerName- the header name(s), space separatedstrategy- RETAIN_FIRST, RETAIN_LAST, or RETAIN_UNIQUE- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
circuitBreaker
public GatewayFilterSpec circuitBreaker(Consumer<SpringCloudCircuitBreakerFilterFactory.Config> configConsumer)
-
jsonToGRPC
public GatewayFilterSpec jsonToGRPC(String protoDescriptor, String protoFile, String service, String method)
A filter that transforms a JSON request into a gRPC one.- Parameters:
protoDescriptor- relative path to the proto descriptor file.protoFile- relative path to the proto definition file.service- fully qualified name of the service that will handle the request.method- method name in the service that will handle the request.
-
mapRequestHeader
public GatewayFilterSpec mapRequestHeader(String fromHeader, String toHeader)
Maps headers from one name to another.- Parameters:
fromHeader- the header name of the original header.toHeader- the header name of the new header.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyRequestBody
public <T,R> GatewayFilterSpec modifyRequestBody(Class<T> inClass, Class<R> outClass, RewriteFunction<T,R> rewriteFunction)
A filter that can be used to modify the request body.- Type Parameters:
T- the original request body classR- the new request body class- Parameters:
inClass- the class to convert the incoming request body tooutClass- the class the Gateway will add to the request before it is routedrewriteFunction- theRewriteFunctionthat transforms the request body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyRequestBody
public <T,R> GatewayFilterSpec modifyRequestBody(Class<T> inClass, Class<R> outClass, String newContentType, RewriteFunction<T,R> rewriteFunction)
A filter that can be used to modify the request body.- Type Parameters:
T- the original request body classR- the new request body class- Parameters:
inClass- the class to convert the incoming request body tooutClass- the class the Gateway will add to the request before it is routednewContentType- the new Content-Type header to be sentrewriteFunction- theRewriteFunctionthat transforms the request body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
cacheRequestBody
public GatewayFilterSpec cacheRequestBody(Class<?> bodyClass)
A filter that can cache the request body.- Parameters:
bodyClass- the class to convert the incoming request body to the original request body class- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyRequestBody
public <T,R> GatewayFilterSpec modifyRequestBody(Consumer<ModifyRequestBodyGatewayFilterFactory.Config> configConsumer)
A filter that can be used to modify the request body.- Type Parameters:
T- the original request body classR- the new request body class- Parameters:
configConsumer- request spec for response modification- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters... .modifyRequestBody(c -> c .setInClass(Some.class) .setOutClass(SomeOther.class) .setInHints(hintsIn) .setOutHints(hintsOut) .setRewriteFunction(rewriteFunction))
-
modifyResponseBody
public <T,R> GatewayFilterSpec modifyResponseBody(Class<T> inClass, Class<R> outClass, RewriteFunction<T,R> rewriteFunction)
A filter that can be used to modify the response body.- Type Parameters:
T- the original response body classR- the new response body class- Parameters:
inClass- the class to conver the response body tooutClass- the class the Gateway will add to the response before it is returned to the clientrewriteFunction- theRewriteFunctionthat transforms the response body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyResponseBody
public <T,R> GatewayFilterSpec modifyResponseBody(Class<T> inClass, Class<R> outClass, String newContentType, RewriteFunction<T,R> rewriteFunction)
A filter that can be used to modify the response body.- Type Parameters:
T- the original response body classR- the new response body class- Parameters:
inClass- the class to conver the response body tooutClass- the class the Gateway will add to the response before it is returned to the clientnewContentType- the new Content-Type header to be returnedrewriteFunction- theRewriteFunctionthat transforms the response body- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
modifyResponseBody
public <T,R> GatewayFilterSpec modifyResponseBody(Consumer<ModifyResponseBodyGatewayFilterFactory.Config> configConsumer)
A filter that can be used to modify the response body using custom spec.- Type Parameters:
T- the original response body classR- the new response body class- Parameters:
configConsumer- response spec for response modification- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters... .modifyResponseBody(c -> c .setInClass(Some.class) .setOutClass(SomeOther.class) .setOutHints(hintsOut) .setRewriteFunction(rewriteFunction))
-
prefixPath
public GatewayFilterSpec prefixPath(String prefix)
A filter that can be used to add a prefix to the path of a request before it is routed by the Gateway.- Parameters:
prefix- the prefix to add to the path- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
preserveHostHeader
public GatewayFilterSpec preserveHostHeader()
A filter that will preserve the host header of the request on the outgoing request from the Gateway.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setHostHeader
public GatewayFilterSpec setHostHeader(String hostName)
A filter that will set the Host header to {@param hostName} on the outgoing request.- Parameters:
hostName- the updated Host header value- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
public GatewayFilterSpec redirect(int status, URI url)
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
public GatewayFilterSpec redirect(int status, String url)
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
public GatewayFilterSpec redirect(String status, URI url)
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
public GatewayFilterSpec redirect(String status, String url)
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
redirect
public GatewayFilterSpec redirect(org.springframework.http.HttpStatus status, URL url)
A filter that will return a redirect response back to the client.- Parameters:
status- an HTTP status code, should be a300series redirecturl- the URL to redirect to. This URL will be set in thelocationheader- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
removeRequestHeader
public GatewayFilterSpec removeRequestHeader(String headerName)
A filter that will remove a request header before the request is routed by the Gateway.- Parameters:
headerName- the name of the header to remove- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
removeRequestParameter
public GatewayFilterSpec removeRequestParameter(String paramName)
A filter that will remove a request param before the request is routed by the Gateway.- Parameters:
paramName- the name of the header to remove- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
removeResponseHeader
public GatewayFilterSpec removeResponseHeader(String headerName)
A filter that will remove a response header before the Gateway returns the response to the client.- Parameters:
headerName- the name of the header to remove- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
requestRateLimiter
public GatewayFilterSpec requestRateLimiter(Consumer<RequestRateLimiterGatewayFilterFactory.Config> configConsumer)
A filter that will set up a request rate limiter for a route.- Parameters:
configConsumer- aConsumerthat will return configuration for the rate limiter- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
requestRateLimiter
public GatewayFilterSpec.RequestRateLimiterSpec requestRateLimiter()
A filter that will set up a request rate limiter for a route.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
rewritePath
public GatewayFilterSpec rewritePath(String regex, String replacement)
A filter which rewrites the request path before it is routed by the Gateway.- Parameters:
regex- a Java regular expression to match the path againstreplacement- the replacement for the path- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
retry
public GatewayFilterSpec retry(int retries)
A filter that will retry failed requests. By default5xxerrors andGETs are retryable.- Parameters:
retries- max number of retries- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
retry
public GatewayFilterSpec retry(Consumer<RetryGatewayFilterFactory.RetryConfig> retryConsumer)
A filter that will retry failed requests.- Parameters:
retryConsumer- aConsumerwhich returns aRetryGatewayFilterFactory.RetryConfigto configure the retry functionality- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
retry
public GatewayFilterSpec retry(reactor.retry.Repeat<org.springframework.web.server.ServerWebExchange> repeat, reactor.retry.Retry<org.springframework.web.server.ServerWebExchange> retry)
A filter that will retry failed requests.- Parameters:
repeat- aRepeatretry- aRetry- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
secureHeaders
public GatewayFilterSpec secureHeaders()
A filter that adds a number of headers to the response at the reccomendation from this blog post.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
secureHeaders
public GatewayFilterSpec secureHeaders(Consumer<SecureHeadersGatewayFilterFactory.Config> configConsumer)
A filter that adds a number of headers to the response at the reccomendation from this blog post.- Parameters:
configConsumer- self define headers- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setPath
public GatewayFilterSpec setPath(String template)
A filter that sets the path of the request before it is routed by the Gateway.- Parameters:
template- the path to set on the request, allows multiple matching segments using URI templates from Spring Framework- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setRequestHeader
public GatewayFilterSpec setRequestHeader(String headerName, String headerValue)
A filter that sets a header on the request before it is routed by the Gateway.- Parameters:
headerName- the header nameheaderValue- the value of the header- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setResponseHeader
public GatewayFilterSpec setResponseHeader(String headerName, String headerValue)
A filter that sets a header on the response before it is returned to the client by the Gateway.- Parameters:
headerName- the header nameheaderValue- the value of the header- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
rewriteResponseHeader
public GatewayFilterSpec rewriteResponseHeader(String headerName, String regex, String replacement)
A filter that rewrites a header value on the response before it is returned to the client by the Gateway.- Parameters:
headerName- the header nameregex- a Java regular expression to match the path againstreplacement- the replacement for the path- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
rewriteLocationResponseHeader
public GatewayFilterSpec rewriteLocationResponseHeader(String stripVersionMode, String locationHeaderName, String hostValue, String protocolsRegex)
A filter that rewrites the value of Location response header, ridding it of backend specific details.- Parameters:
stripVersionMode- NEVER_STRIP, AS_IN_REQUEST, or ALWAYS_STRIPlocationHeaderName- a location header namehostValue- host valueprotocolsRegex- a valid regex String, against which the protocol name will be matched- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setStatus
public GatewayFilterSpec setStatus(int status)
A filter that sets the status on the response before it is returned to the client by the Gateway.- Parameters:
status- the status to set on the response- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setStatus
public GatewayFilterSpec setStatus(org.springframework.http.HttpStatus status)
A filter that sets the status on the response before it is returned to the client by the Gateway.- Parameters:
status- the status to set on the response- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setStatus
public GatewayFilterSpec setStatus(String status)
A filter that sets the status on the response before it is returned to the client by the Gateway.- Parameters:
status- the status to set on the response- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
saveSession
public GatewayFilterSpec saveSession()
A filter which forces aWebSession::saveoperation before forwarding the call downstream. This is of particular use when using something like Spring Session with a lazy data store and need to ensure the session state has been saved before making the forwarded call. If you are integrating Spring Security with Spring Session, and want to ensure security details have been forwarded to the remote process, this is critical.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
stripPrefix
public GatewayFilterSpec stripPrefix(int parts)
Strips the prefix from the path of the request before it is routed by the Gateway.- Parameters:
parts- the number of parts of the path to remove- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
requestHeaderToRequestUri
public GatewayFilterSpec requestHeaderToRequestUri(String headerName)
A filter which changes the URI the request will be routed to by the Gateway by pulling it from a header on the request.- Parameters:
headerName- the header name containing the URI- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
changeRequestUri
public GatewayFilterSpec changeRequestUri(Function<org.springframework.web.server.ServerWebExchange,Optional<URI>> determineRequestUri)
A filter which change the URI the request will be routed to by the Gateway.- Parameters:
determineRequestUri- aFunctionwhich takes aServerWebExchangeand returns a URI to route the request to- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setRequestSize
public GatewayFilterSpec setRequestSize(Long size)
A filter that sets the maximum permissible size of a Request.- Parameters:
size- the maximum size of a request- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setRequestSize
public GatewayFilterSpec setRequestSize(org.springframework.util.unit.DataSize size)
A filter that sets the maximum permissible size of a Request.- Parameters:
size- the maximum size of a request- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
setRequestHeaderSize
public GatewayFilterSpec setRequestHeaderSize(org.springframework.util.unit.DataSize size)
A filter that sets the maximum permissible size of headers of Request.- Parameters:
size- the maximum size of header of request- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
tokenRelay
public GatewayFilterSpec tokenRelay()
A filter that enables token relay.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
fallbackHeaders
public GatewayFilterSpec fallbackHeaders(FallbackHeadersGatewayFilterFactory.Config config)
Adds hystrix execution exception headers to fallback request. Depends on @{code org.springframework.cloud::spring-cloud-starter-netflix-hystrix} being on the classpath, {@see https://cloud.spring.io/spring-cloud-netflix/}- Parameters:
config- aFallbackHeadersGatewayFilterFactory.Configwhich provides the header names. If header names arguments are not provided, default values are used.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
fallbackHeaders
public GatewayFilterSpec fallbackHeaders(Consumer<FallbackHeadersGatewayFilterFactory.Config> configConsumer)
Adds hystrix execution exception headers to fallback request. Depends on @{code org.springframework.cloud::spring-cloud-starter-netflix-hystrix} being on the classpath, {@see https://cloud.spring.io/spring-cloud-netflix/}- Parameters:
configConsumer- aConsumerwhich can be used to set up the names of the headers in the config. If header names arguments are not provided, default values are used.- Returns:
- a
GatewayFilterSpecthat can be used to apply additional filters
-
-