Top Description Methods
org.springframework.web.servlet.function

public Interface AsyncServerResponse

extends ServerResponse
Known Direct Implementers
org.springframework.web.servlet.function.DefaultAsyncServerResponse
Imports
java.time.Duration, java.util.concurrent.CompletableFuture, org.reactivestreams.Publisher, org.springframework.core.ReactiveAdapterRegistry

Asynchronous subtype of ServerResponse that exposes the future response.
Author
Arjen Poutsma
Since
5.3.2
See Also
ServerResponse#async(Object)

Method Summary

Modifier and TypeMethod and Description
public ServerResponse
block()

Blocks indefinitely until the future response is obtained.

public static AsyncServerResponse

Returns:

the asynchronous response
create
(Object
a CompletableFuture<ServerResponse> or Publisher<ServerResponse>
asyncResponse
)

Create a AsyncServerResponse with the given asynchronous response.

public static AsyncServerResponse

Returns:

the asynchronous response
create
(Object
a CompletableFuture<ServerResponse> or Publisher<ServerResponse>
asyncResponse
,
Duration
maximum time period to wait for before timing out
timeout
)

Create a (built) response with the given asynchronous response.

Inherited from org.springframework.web.servlet.function.ServerResponse:
acceptedasyncasyncbadRequestcookiescreatedfromfromheadersnoContentnotFoundokpermanentRedirectrawStatusCodeseeOtherssessestatusstatusstatusCodetemporaryRedirectunprocessableEntitywriteTo

Method Detail

blockback to summary
public ServerResponse block()

Blocks indefinitely until the future response is obtained.

createback to summary
public static AsyncServerResponse create(Object asyncResponse)

Create a AsyncServerResponse with the given asynchronous response. Parameter asyncResponse can be a CompletableFuture<ServerResponse> or Publisher<ServerResponse> (or any asynchronous producer of a single ServerResponse that can be adapted via the ReactiveAdapterRegistry).

Parameters
asyncResponse:Object

a CompletableFuture<ServerResponse> or Publisher<ServerResponse>

Returns:AsyncServerResponse

the asynchronous response

createback to summary
public static AsyncServerResponse create(Object asyncResponse, Duration timeout)

Create a (built) response with the given asynchronous response. Parameter asyncResponse can be a CompletableFuture<ServerResponse> or Publisher<ServerResponse> (or any asynchronous producer of a single ServerResponse that can be adapted via the ReactiveAdapterRegistry).

Parameters
asyncResponse:Object

a CompletableFuture<ServerResponse> or Publisher<ServerResponse>

timeout:Duration

maximum time period to wait for before timing out

Returns:AsyncServerResponse

the asynchronous response