public interface Response
Represents a server response in a server exchange.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
Exchange
-
Method Summary
Modifier and TypeMethodDescriptionbody()Returns the response body used to produce response payload.cookies(Consumer<ResponseCookies> cookiesConfigurer)Configures the cookies to set in the response.headers()Returns the HTTP headers to send in the response.headers(Consumer<ResponseHeaders> headersConfigurer)Configures the HTTP headers to send in the response.booleanDetermines whether the response headers have been sent to the client.trailers()Returns the HTTP trailers to send in the response.trailers(Consumer<ResponseTrailers> trailersConfigurer)Configures the HTTP trailers to send in the response.
-
Method Details
-
isHeadersWritten
boolean isHeadersWritten()Determines whether the response headers have been sent to the client.
Any attempts to specify new headers in the response, once headers haven been sent to the client, will result in an
IllegalStateExceptionbeing thrown.- Returns:
- true if headers have been sent, false otherwise
-
headers
ResponseHeaders headers()Returns the HTTP headers to send in the response.
- Returns:
- the headers
-
headers
Configures the HTTP headers to send in the response.
- Parameters:
headersConfigurer- a response headers configurer- Returns:
- the response
- Throws:
IllegalStateException- if response headers have already been sent to the client
-
trailers
ResponseTrailers trailers()Returns the HTTP trailers to send in the response.
- Returns:
- the trailers
-
trailers
Configures the HTTP trailers to send in the response.
- Parameters:
trailersConfigurer- a response trailers configurer- Returns:
- the response
-
cookies
Configures the cookies to set in the response.
- Parameters:
cookiesConfigurer- a response cookies configurer- Returns:
- the response
- Throws:
IllegalStateException- if response headers have already been sent to the client
-
body
ResponseBody body()Returns the response body used to produce response payload.
- Returns:
- a response body
-