T
- the type of the body that this response containspublic interface Response<T>
Modifier and Type | Interface and Description |
---|---|
static interface |
Response.BodyBuilder
Defines a builder that adds a body to the response.
|
static interface |
Response.HeadersBuilder<B extends Response.HeadersBuilder<B>>
Defines a builder that adds headers to the response.
|
Modifier and Type | Method and Description |
---|---|
static Response.BodyBuilder |
accepted()
Create a builder with an ACCEPTED status.
|
static Response.BodyBuilder |
badRequest()
Create a builder with a BAD_REQUEST status.
|
T |
body()
Return the body of this response.
|
static Response.BodyBuilder |
created(URI location)
Create a new builder with a CREATED status
and a location header set to the given URI.
|
static Response.BodyBuilder |
from(Response<?> other)
Create a builder with the status code and headers of the given response.
|
HttpHeaders |
headers()
Return the headers of this response.
|
static Response.HeadersBuilder<?> |
noContent()
Create a builder with a NO_CONTENT status.
|
static Response.HeadersBuilder<?> |
notFound()
Create a builder with a NOT_FOUND status.
|
static Response.BodyBuilder |
ok()
Create a builder with the status set to OK.
|
static Response.BodyBuilder |
status(HttpStatus status)
Create a builder with the given status.
|
static Response.BodyBuilder |
status(int status)
Create a builder with the given status.
|
HttpStatus |
statusCode()
Return the status code of this response.
|
static Response.BodyBuilder |
unprocessableEntity()
Create a builder with an
UNPROCESSABLE_ENTITY status.
|
reactor.core.publisher.Mono<Void> |
writeTo(ServerWebExchange exchange,
StrategiesSupplier strategies)
Writes this response to the given web exchange.
|
HttpStatus statusCode()
HttpHeaders headers()
T body()
reactor.core.publisher.Mono<Void> writeTo(ServerWebExchange exchange, StrategiesSupplier strategies)
exchange
- the web exchange to write tostrategies
- the strategies to use when writingMono<Void>
to indicate when request handling is completestatic Response.BodyBuilder from(Response<?> other)
other
- the response to copy the status and headers fromstatic Response.BodyBuilder status(HttpStatus status)
status
- the response statusstatic Response.BodyBuilder status(int status)
status
- the response statusstatic Response.BodyBuilder ok()
static Response.BodyBuilder created(URI location)
location
- the location URIstatic Response.BodyBuilder accepted()
static Response.HeadersBuilder<?> noContent()
static Response.BodyBuilder badRequest()
static Response.HeadersBuilder<?> notFound()
static Response.BodyBuilder unprocessableEntity()