Top Description Inners Fields Constructors Methods
org.springframework.web.server

pack-priv Class DefaultServerWebExchangeBuilder

extends Object
implements Builder
Class Inheritance
All Implemented Interfaces
org.springframework.web.server.ServerWebExchange.Builder
Imports
java.security.Principal, java.util.function.Consumer, reactor.core.publisher.Mono, org.springframework.http.server.reactive.ServerHttpRequest, .ServerHttpResponse, org.springframework.lang.Nullable, org.springframework.util.Assert

Package-private implementation of ServerWebExchange.Builder.
Author
Rossen Stoyanchev
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
DefaultServerWebExchangeBuilder.MutativeDecorator

An immutable wrapper of an exchange returning property overrides -- given to the constructor -- or original values otherwise.

Field Summary

Modifier and TypeField and Description
private final ServerWebExchange
private Mono<Principal>
private ServerHttpRequest
private ServerHttpResponse

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public ServerWebExchange
build()

Implements org.springframework.web.server.ServerWebExchange.Builder.build.

Build a ServerWebExchange decorator with the mutated properties.

public ServerWebExchange.Builder
principal(Mono<Principal> principalMono)

Implements org.springframework.web.server.ServerWebExchange.Builder.principal.

Set the Mono<Principal> to return for this exchange.

public ServerWebExchange.Builder
request(Consumer<ServerHttpRequest.Builder> consumer)

Implements org.springframework.web.server.ServerWebExchange.Builder.request.

Configure a consumer to modify the current request using a builder.

public ServerWebExchange.Builder
request(ServerHttpRequest request)

Implements org.springframework.web.server.ServerWebExchange.Builder.request.

Set the request to use especially when there is a need to override ServerHttpRequest methods.

public ServerWebExchange.Builder
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final ServerWebExchange delegate
principalMonoback to summary
private Mono<Principal> principalMono
Annotations
@Nullable
requestback to summary
private ServerHttpRequest request
Annotations
@Nullable
responseback to summary
private ServerHttpResponse response
Annotations
@Nullable

Constructor Detail

DefaultServerWebExchangeBuilderback to summary
pack-priv DefaultServerWebExchangeBuilder(ServerWebExchange delegate)

Method Detail

buildback to summary
public ServerWebExchange build()

Implements org.springframework.web.server.ServerWebExchange.Builder.build.

Doc from org.springframework.web.server.ServerWebExchange.Builder.build.

Build a ServerWebExchange decorator with the mutated properties.

Annotations
@Override
principalback to summary
public ServerWebExchange.Builder principal(Mono<Principal> principalMono)

Implements org.springframework.web.server.ServerWebExchange.Builder.principal.

Doc from org.springframework.web.server.ServerWebExchange.Builder.principal.

Set the Mono<Principal> to return for this exchange.

Annotations
@Override
requestback to summary
public ServerWebExchange.Builder request(Consumer<ServerHttpRequest.Builder> consumer)

Implements org.springframework.web.server.ServerWebExchange.Builder.request.

Doc from org.springframework.web.server.ServerWebExchange.Builder.request.

Configure a consumer to modify the current request using a builder.

Effectively this:

exchange.mutate().request(builder -> builder.method(HttpMethod.PUT));

// vs...

ServerHttpRequest request = exchange.getRequest().mutate()
    .method(HttpMethod.PUT)
    .build();

exchange.mutate().request(request);
Annotations
@Override
requestback to summary
public ServerWebExchange.Builder request(ServerHttpRequest request)

Implements org.springframework.web.server.ServerWebExchange.Builder.request.

Doc from org.springframework.web.server.ServerWebExchange.Builder.request.

Set the request to use especially when there is a need to override ServerHttpRequest methods. To simply mutate request properties see request(Consumer) instead.

Annotations
@Override
responseback to summary
public ServerWebExchange.Builder response(ServerHttpResponse response)

Implements org.springframework.web.server.ServerWebExchange.Builder.response.

Doc from org.springframework.web.server.ServerWebExchange.Builder.response.

Set the response to use.

Annotations
@Override
org.springframework.web.server back to summary

private Class DefaultServerWebExchangeBuilder.MutativeDecorator

extends ServerWebExchangeDecorator
Class Inheritance

An immutable wrapper of an exchange returning property overrides -- given to the constructor -- or original values otherwise.

Field Summary

Modifier and TypeField and Description
private final Mono<Principal>
private final ServerHttpRequest
private final ServerHttpResponse

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <T extends Principal> Mono<T>
public ServerHttpRequest
public ServerHttpResponse
Inherited from org.springframework.web.server.ServerWebExchangeDecorator:
addUrlTransformercheckNotModifiedcheckNotModifiedcheckNotModifiedcleanupMultipartgetApplicationContextgetAttributesgetDelegategetFormDatagetLocaleContextgetLogPrefixgetMultipartDatagetSessionisNotModifiedtoStringtransformUrl

Field Detail

principalMonoback to summary
private final Mono<Principal> principalMono
Annotations
@Nullable
requestback to summary
private final ServerHttpRequest request
Annotations
@Nullable
responseback to summary
private final ServerHttpResponse response
Annotations
@Nullable

Constructor Detail

MutativeDecoratorback to summary
public MutativeDecorator(ServerWebExchange delegate, ServerHttpRequest request, ServerHttpResponse response, Mono<Principal> principalMono)

Method Detail

getPrincipalback to summary
public <T extends Principal> Mono<T> getPrincipal()

Overrides org.springframework.web.server.ServerWebExchangeDecorator.getPrincipal.

Implements org.springframework.web.server.ServerWebExchange.getPrincipal.

Doc from org.springframework.web.server.ServerWebExchange.getPrincipal.

Return the authenticated user for the request, if any.

Annotations
@SuppressWarnings:unchecked
@Override
getRequestback to summary
public ServerHttpRequest getRequest()

Overrides org.springframework.web.server.ServerWebExchangeDecorator.getRequest.

Implements org.springframework.web.server.ServerWebExchange.getRequest.

Doc from org.springframework.web.server.ServerWebExchange.getRequest.

Return the current HTTP request.

Annotations
@Override
getResponseback to summary
public ServerHttpResponse getResponse()

Overrides org.springframework.web.server.ServerWebExchangeDecorator.getResponse.

Implements org.springframework.web.server.ServerWebExchange.getResponse.

Doc from org.springframework.web.server.ServerWebExchange.getResponse.

Return the current HTTP response.

Annotations
@Override