public interface ServerResponse
Modifier and Type | Interface and Description |
---|---|
static interface |
ServerResponse.BodyBuilder
Defines a builder that adds a body to the response.
|
static interface |
ServerResponse.Context
Defines the context used during the
writeTo(ServerWebExchange, Context) . |
static interface |
ServerResponse.HeadersBuilder<B extends ServerResponse.HeadersBuilder<B>>
Defines a builder that adds headers to the response.
|
Modifier and Type | Method and Description |
---|---|
static ServerResponse.BodyBuilder |
accepted()
Create a builder with an 202 Accepted status.
|
static ServerResponse.BodyBuilder |
badRequest()
Create a builder with a 400 Bad Request status.
|
MultiValueMap<String,ResponseCookie> |
cookies()
Return the cookies of this response.
|
static ServerResponse.BodyBuilder |
created(URI location)
Create a new builder with a 201 Created status
and a location header set to the given URI.
|
static ServerResponse.BodyBuilder |
from(ServerResponse other)
Create a builder with the status code and headers of the given response.
|
HttpHeaders |
headers()
Return the headers of this response.
|
static ServerResponse.HeadersBuilder<?> |
noContent()
Create a builder with a 204 No Content status.
|
static ServerResponse.HeadersBuilder<?> |
notFound()
Create a builder with a 404 Not Found status.
|
static ServerResponse.BodyBuilder |
ok()
Create a builder with the status set to 200 OK.
|
static ServerResponse.BodyBuilder |
permanentRedirect(URI location)
Create a builder with a 308 Permanent Redirect
status and a location header set to the given URI.
|
int |
rawStatusCode()
Return the (potentially non-standard) status code of this response.
|
static ServerResponse.BodyBuilder |
seeOther(URI location)
Create a builder with a 303 See Other
status and a location header set to the given URI.
|
static ServerResponse.BodyBuilder |
status(HttpStatus status)
Create a builder with the given HTTP status.
|
static ServerResponse.BodyBuilder |
status(int status)
Create a builder with the given HTTP status.
|
HttpStatus |
statusCode()
Return the status code of this response.
|
static ServerResponse.BodyBuilder |
temporaryRedirect(URI location)
Create a builder with a 307 Temporary Redirect
status and a location header set to the given URI.
|
static ServerResponse.BodyBuilder |
unprocessableEntity()
Create a builder with an
422 Unprocessable Entity status.
|
reactor.core.publisher.Mono<Void> |
writeTo(ServerWebExchange exchange,
ServerResponse.Context context)
Write this response to the given web exchange.
|
HttpStatus statusCode()
IllegalArgumentException
- in case of an unknown HTTP status codeHttpStatus.valueOf(int)
int rawStatusCode()
statusCode()
,
HttpStatus.resolve(int)
HttpHeaders headers()
MultiValueMap<String,ResponseCookie> cookies()
reactor.core.publisher.Mono<Void> writeTo(ServerWebExchange exchange, ServerResponse.Context context)
exchange
- the web exchange to write tocontext
- the context to use when writingMono<Void>
to indicate when writing is completestatic ServerResponse.BodyBuilder from(ServerResponse other)
other
- the response to copy the status and headers fromstatic ServerResponse.BodyBuilder status(HttpStatus status)
status
- the response statusstatic ServerResponse.BodyBuilder status(int status)
status
- the response statusstatic ServerResponse.BodyBuilder ok()
static ServerResponse.BodyBuilder created(URI location)
location
- the location URIstatic ServerResponse.BodyBuilder accepted()
static ServerResponse.HeadersBuilder<?> noContent()
static ServerResponse.BodyBuilder seeOther(URI location)
location
- the location URIstatic ServerResponse.BodyBuilder temporaryRedirect(URI location)
location
- the location URIstatic ServerResponse.BodyBuilder permanentRedirect(URI location)
location
- the location URIstatic ServerResponse.BodyBuilder badRequest()
static ServerResponse.HeadersBuilder<?> notFound()
static ServerResponse.BodyBuilder unprocessableEntity()