Interface GatewayServerResponse
- All Superinterfaces:
org.springframework.web.servlet.function.ServerResponse
public interface GatewayServerResponse
extends org.springframework.web.servlet.function.ServerResponse
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.web.servlet.function.ServerResponse
org.springframework.web.servlet.function.ServerResponse.BodyBuilder, org.springframework.web.servlet.function.ServerResponse.Context, org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<B extends org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<B>>, org.springframework.web.servlet.function.ServerResponse.SseBuilder, org.springframework.web.servlet.function.ServerResponse.StreamBuilder -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.web.servlet.function.ServerResponse.BodyBuilderaccepted()Create a builder with a 202 Accepted status.static org.springframework.web.servlet.function.ServerResponseCreate a (built) response with the given asynchronous response.static org.springframework.web.servlet.function.ServerResponseCreate a (built) response with the given asynchronous response.static org.springframework.web.servlet.function.ServerResponse.BodyBuilderCreate a builder with a 400 Bad Request status.static org.springframework.web.servlet.function.ServerResponse.BodyBuilderCreate a builder with a 201 Created status and a location header set to the given URI.static org.springframework.web.servlet.function.ServerResponsefrom(org.springframework.web.ErrorResponse response) Create aServerResponsefrom the givenErrorResponse.static org.springframework.web.servlet.function.ServerResponse.BodyBuilderfrom(org.springframework.web.servlet.function.ServerResponse other) Create a builder with the status code and headers of the given response.static org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<?>Create a builder with a 204 No Content status.static org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<?>notFound()Create a builder with a 404 Not Found status.static org.springframework.web.servlet.function.ServerResponse.BodyBuilderok()Create a builder with the status set to 200 OK.static org.springframework.web.servlet.function.ServerResponse.BodyBuilderpermanentRedirect(URI location) Create a builder with a 308 Permanent Redirect status and a location header set to the given URI.static org.springframework.web.servlet.function.ServerResponse.BodyBuilderCreate a builder with a 303 See Other status and a location header set to the given URI.voidsetStatusCode(org.springframework.http.HttpStatusCode statusCode) static org.springframework.web.servlet.function.ServerResponse.BodyBuilderstatus(int status) Create a builder with the given HTTP status.static org.springframework.web.servlet.function.ServerResponse.BodyBuilderstatus(org.springframework.http.HttpStatusCode status) Create a builder with the given HTTP status.static org.springframework.web.servlet.function.ServerResponse.BodyBuildertemporaryRedirect(URI location) Create a builder with a 307 Temporary Redirect status and a location header set to the given URI.static org.springframework.web.servlet.function.ServerResponse.BodyBuilderCreate a builder with a 422 Unprocessable Entity status.Methods inherited from interface org.springframework.web.servlet.function.ServerResponse
cookies, headers, statusCode, writeTo
-
Method Details
-
setStatusCode
void setStatusCode(org.springframework.http.HttpStatusCode statusCode) -
from
static org.springframework.web.servlet.function.ServerResponse.BodyBuilder from(org.springframework.web.servlet.function.ServerResponse other) Create a builder with the status code and headers of the given response.- Parameters:
other- the response to copy the status and headers from- Returns:
- the created builder
-
from
static org.springframework.web.servlet.function.ServerResponse from(org.springframework.web.ErrorResponse response) Create aServerResponsefrom the givenErrorResponse.- Parameters:
response- theErrorResponseto initialize from- Returns:
- the built response
- Since:
- 6.0
-
status
static org.springframework.web.servlet.function.ServerResponse.BodyBuilder status(org.springframework.http.HttpStatusCode status) Create a builder with the given HTTP status.- Parameters:
status- the response status- Returns:
- the created builder
-
status
static org.springframework.web.servlet.function.ServerResponse.BodyBuilder status(int status) Create a builder with the given HTTP status.- Parameters:
status- the response status- Returns:
- the created builder
-
ok
static org.springframework.web.servlet.function.ServerResponse.BodyBuilder ok()Create a builder with the status set to 200 OK.- Returns:
- the created builder
-
created
Create a builder with a 201 Created status and a location header set to the given URI.- Parameters:
location- the location URI- Returns:
- the created builder
-
accepted
static org.springframework.web.servlet.function.ServerResponse.BodyBuilder accepted()Create a builder with a 202 Accepted status.- Returns:
- the created builder
-
noContent
static org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<?> noContent()Create a builder with a 204 No Content status.- Returns:
- the created builder
-
seeOther
Create a builder with a 303 See Other status and a location header set to the given URI.- Parameters:
location- the location URI- Returns:
- the created builder
-
temporaryRedirect
static org.springframework.web.servlet.function.ServerResponse.BodyBuilder temporaryRedirect(URI location) Create a builder with a 307 Temporary Redirect status and a location header set to the given URI.- Parameters:
location- the location URI- Returns:
- the created builder
-
permanentRedirect
static org.springframework.web.servlet.function.ServerResponse.BodyBuilder permanentRedirect(URI location) Create a builder with a 308 Permanent Redirect status and a location header set to the given URI.- Parameters:
location- the location URI- Returns:
- the created builder
-
badRequest
static org.springframework.web.servlet.function.ServerResponse.BodyBuilder badRequest()Create a builder with a 400 Bad Request status.- Returns:
- the created builder
-
notFound
static org.springframework.web.servlet.function.ServerResponse.HeadersBuilder<?> notFound()Create a builder with a 404 Not Found status.- Returns:
- the created builder
-
unprocessableEntity
static org.springframework.web.servlet.function.ServerResponse.BodyBuilder unprocessableEntity()Create a builder with a 422 Unprocessable Entity status.- Returns:
- the created builder
-
async
Create a (built) response with the given asynchronous response. ParameterasyncResponsecan be aCompletableFuture<ServerResponse>orPublisher<ServerResponse>(or any asynchronous producer of a singleServerResponsethat can be adapted via theReactiveAdapterRegistry).This method can be used to set the response status code, headers, and body based on an asynchronous result. If only the body is asynchronous,
ServerResponse.BodyBuilder.body(Object)can be used instead.- Parameters:
asyncResponse- aCompletableFuture<ServerResponse>orPublisher<ServerResponse>- Returns:
- the asynchronous response
- Since:
- 5.3
-
async
static org.springframework.web.servlet.function.ServerResponse async(Object asyncResponse, Duration timeout) Create a (built) response with the given asynchronous response. ParameterasyncResponsecan be aCompletableFuture<ServerResponse>orPublisher<ServerResponse>(or any asynchronous producer of a singleServerResponsethat can be adapted via theReactiveAdapterRegistry).This method can be used to set the response status code, headers, and body based on an asynchronous result. If only the body is asynchronous,
ServerResponse.BodyBuilder.body(Object)can be used instead.- Parameters:
asyncResponse- aCompletableFuture<ServerResponse>orPublisher<ServerResponse>timeout- maximum time period to wait for before timing out- Returns:
- the asynchronous response
- Since:
- 5.3.2
-