Interface Response

All Superinterfaces:
BaseResponse
All Known Subinterfaces:
WebResponse

public interface Response extends BaseResponse

Represents a server response in a server exchange.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • 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 IllegalStateException being thrown.

      Returns:
      true if headers have been sent, false otherwise
    • headers

      Response headers(Consumer<OutboundResponseHeaders> headersConfigurer) throws IllegalStateException

      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

      Response trailers(Consumer<OutboundHeaders<?>> trailersConfigurer)

      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 headers.

      Parameters:
      cookiesConfigurer - a response cookies configurer
      Returns:
      the response
      Throws:
      IllegalStateException - if response headers have already been sent to the client
    • sendContinue

      Response sendContinue()

      Sends an interim 100 continue response to the client so it can send the rest of the request.

      This method should only be used when the request contains header expect: 100-continue.

      Returns:
      the response
    • body

      ResponseBody body()

      Returns the response body used to produce response payload.

      Returns:
      a response body