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.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 ACCEPTED status.
|
static ServerResponse.BodyBuilder |
badRequest()
Create a builder with a BAD_REQUEST status.
|
static ServerResponse.BodyBuilder |
created(java.net.URI location)
Create a new builder with a 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 NO_CONTENT status.
|
static ServerResponse.HeadersBuilder<?> |
notFound()
Create a builder with a NOT_FOUND status.
|
static ServerResponse.BodyBuilder |
ok()
Create a builder with the status set to OK.
|
static ServerResponse.BodyBuilder |
status(HttpStatus status)
Create a builder with the given status.
|
HttpStatus |
statusCode()
Return the status code of this response.
|
static ServerResponse.BodyBuilder |
unprocessableEntity()
Create a builder with an
UNPROCESSABLE_ENTITY status.
|
<any> |
writeTo(ServerWebExchange exchange,
HandlerStrategies strategies)
Write this response to the given web exchange.
|
HttpStatus statusCode()
HttpHeaders headers()
<any> writeTo(ServerWebExchange exchange, HandlerStrategies strategies)
exchange
- the web exchange to write tostrategies
- the strategies 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 ok()
static ServerResponse.BodyBuilder created(java.net.URI location)
location
- the location URIstatic ServerResponse.BodyBuilder accepted()
static ServerResponse.HeadersBuilder<?> noContent()
static ServerResponse.BodyBuilder badRequest()
static ServerResponse.HeadersBuilder<?> notFound()
static ServerResponse.BodyBuilder unprocessableEntity()