public final class ServerWebExchangeUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CACHED_REQUEST_BODY_ATTR
Cached request body key.
|
static String |
CACHED_SERVER_HTTP_REQUEST_DECORATOR_ATTR
Cached ServerHttpRequestDecorator attribute name.
|
static String |
CIRCUITBREAKER_EXECUTION_EXCEPTION_ATTR
CircuitBreaker execution exception attribute name.
|
static String |
CLIENT_RESPONSE_ATTR
Client response attribute name.
|
static String |
CLIENT_RESPONSE_CONN_ATTR
Client response connection attribute name.
|
static String |
CLIENT_RESPONSE_HEADER_NAMES
Client response header names attribute name.
|
static String |
GATEWAY_ALREADY_PREFIXED_ATTR
Gateway already prefixed attribute name.
|
static String |
GATEWAY_ALREADY_ROUTED_ATTR
Used when a routing filter has been successfully called.
|
static String |
GATEWAY_HANDLER_MAPPER_ATTR
Gateway handler mapper attribute name.
|
static String |
GATEWAY_ORIGINAL_REQUEST_URL_ATTR
Gateway original request URL attribute name.
|
static String |
GATEWAY_PREDICATE_ROUTE_ATTR
Gateway predicate route attribute name.
|
static String |
GATEWAY_REQUEST_URL_ATTR
Gateway request URL attribute name.
|
static String |
GATEWAY_ROUTE_ATTR
Gateway route attribute name.
|
static String |
GATEWAY_SCHEME_PREFIX_ATTR
Gateway scheme prefix attribute name.
|
static String |
HYSTRIX_EXECUTION_EXCEPTION_ATTR
Hystrix execution exception attribute name.
|
static String |
ORIGINAL_RESPONSE_CONTENT_TYPE_ATTR
Original response Content-Type attribute name.
|
static String |
PRESERVE_HOST_HEADER_ATTRIBUTE
Preserve-Host header attribute name.
|
static String |
URI_TEMPLATE_VARIABLES_ATTRIBUTE
URI template variables attribute name.
|
static String |
WEIGHT_ATTR
Weight attribute name.
|
Modifier and Type | Method and Description |
---|---|
static void |
addOriginalRequestUrl(org.springframework.web.server.ServerWebExchange exchange,
URI url) |
static <T> reactor.core.publisher.Mono<T> |
cacheRequestBody(org.springframework.web.server.ServerWebExchange exchange,
Function<org.springframework.http.server.reactive.ServerHttpRequest,reactor.core.publisher.Mono<T>> function)
Caches the request body in a ServerWebExchange attributes.
|
static <T> reactor.core.publisher.Mono<T> |
cacheRequestBodyAndRequest(org.springframework.web.server.ServerWebExchange exchange,
Function<org.springframework.http.server.reactive.ServerHttpRequest,reactor.core.publisher.Mono<T>> function)
Caches the request body and the created
ServerHttpRequestDecorator in
ServerWebExchange attributes. |
static boolean |
containsEncodedParts(URI uri) |
static String |
expand(org.springframework.web.server.ServerWebExchange exchange,
String template) |
static Map<String,String> |
getUriTemplateVariables(org.springframework.web.server.ServerWebExchange exchange) |
static boolean |
isAlreadyRouted(org.springframework.web.server.ServerWebExchange exchange) |
static org.springframework.http.HttpStatus |
parse(String statusString) |
static void |
putUriTemplateVariables(org.springframework.web.server.ServerWebExchange exchange,
Map<String,String> uriVariables) |
static void |
setAlreadyRouted(org.springframework.web.server.ServerWebExchange exchange) |
static boolean |
setResponseStatus(org.springframework.web.server.ServerWebExchange exchange,
org.springframework.http.HttpStatus httpStatus) |
static boolean |
setResponseStatus(org.springframework.web.server.ServerWebExchange exchange,
HttpStatusHolder statusHolder) |
static AsyncPredicate<org.springframework.web.server.ServerWebExchange> |
toAsyncPredicate(Predicate<? super org.springframework.web.server.ServerWebExchange> predicate) |
public static final String PRESERVE_HOST_HEADER_ATTRIBUTE
public static final String URI_TEMPLATE_VARIABLES_ATTRIBUTE
public static final String CLIENT_RESPONSE_ATTR
public static final String CLIENT_RESPONSE_CONN_ATTR
public static final String CLIENT_RESPONSE_HEADER_NAMES
public static final String GATEWAY_ROUTE_ATTR
public static final String GATEWAY_REQUEST_URL_ATTR
public static final String GATEWAY_ORIGINAL_REQUEST_URL_ATTR
public static final String GATEWAY_HANDLER_MAPPER_ATTR
public static final String GATEWAY_SCHEME_PREFIX_ATTR
public static final String GATEWAY_PREDICATE_ROUTE_ATTR
public static final String WEIGHT_ATTR
public static final String ORIGINAL_RESPONSE_CONTENT_TYPE_ATTR
public static final String HYSTRIX_EXECUTION_EXCEPTION_ATTR
public static final String CIRCUITBREAKER_EXECUTION_EXCEPTION_ATTR
public static final String GATEWAY_ALREADY_ROUTED_ATTR
public static final String GATEWAY_ALREADY_PREFIXED_ATTR
public static final String CACHED_SERVER_HTTP_REQUEST_DECORATOR_ATTR
cacheRequestBodyAndRequest(ServerWebExchange, Function)
is called.public static final String CACHED_REQUEST_BODY_ATTR
cacheRequestBodyAndRequest(ServerWebExchange, Function)
or
cacheRequestBody(ServerWebExchange, Function)
are called.public static void setAlreadyRouted(org.springframework.web.server.ServerWebExchange exchange)
public static boolean isAlreadyRouted(org.springframework.web.server.ServerWebExchange exchange)
public static boolean setResponseStatus(org.springframework.web.server.ServerWebExchange exchange, org.springframework.http.HttpStatus httpStatus)
public static boolean setResponseStatus(org.springframework.web.server.ServerWebExchange exchange, HttpStatusHolder statusHolder)
public static boolean containsEncodedParts(URI uri)
public static org.springframework.http.HttpStatus parse(String statusString)
public static void addOriginalRequestUrl(org.springframework.web.server.ServerWebExchange exchange, URI url)
public static AsyncPredicate<org.springframework.web.server.ServerWebExchange> toAsyncPredicate(Predicate<? super org.springframework.web.server.ServerWebExchange> predicate)
public static String expand(org.springframework.web.server.ServerWebExchange exchange, String template)
public static void putUriTemplateVariables(org.springframework.web.server.ServerWebExchange exchange, Map<String,String> uriVariables)
public static Map<String,String> getUriTemplateVariables(org.springframework.web.server.ServerWebExchange exchange)
public static <T> reactor.core.publisher.Mono<T> cacheRequestBodyAndRequest(org.springframework.web.server.ServerWebExchange exchange, Function<org.springframework.http.server.reactive.ServerHttpRequest,reactor.core.publisher.Mono<T>> function)
ServerHttpRequestDecorator
in
ServerWebExchange attributes. Those attributes are
CACHED_REQUEST_BODY_ATTR
and
CACHED_SERVER_HTTP_REQUEST_DECORATOR_ATTR
respectively. This method is
useful when the ServerWebExchange
can not be modified, such as a
RoutePredicateFactory
.T
- generic type for the return Mono
.exchange
- the available ServerWebExchange.function
- a function that accepts the created ServerHttpRequestDecorator.public static <T> reactor.core.publisher.Mono<T> cacheRequestBody(org.springframework.web.server.ServerWebExchange exchange, Function<org.springframework.http.server.reactive.ServerHttpRequest,reactor.core.publisher.Mono<T>> function)
CACHED_REQUEST_BODY_ATTR
. This method is useful when the
ServerWebExchange
can be mutated, such as a GatewayFilterFactory
/T
- generic type for the return Mono
.exchange
- the available ServerWebExchange.function
- a function that accepts the created ServerHttpRequestDecorator.Copyright © 2019 Pivotal Software, Inc.. All rights reserved.