Interface Response


public interface Response

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

      ResponseHeaders headers()

      Returns the HTTP headers to send in the response.

      Returns:
      the headers
    • headers

      Response headers(Consumer<ResponseHeaders> 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

      ResponseTrailers trailers()

      Returns the HTTP trailers to send in the response.

      Returns:
      the trailers
    • trailers

      Response trailers(Consumer<ResponseTrailers> trailersConfigurer)

      Configures the HTTP trailers to send in the response.

      Parameters:
      trailersConfigurer - a response trailers configurer
      Returns:
      the response
    • cookies

      Response cookies(Consumer<ResponseCookies> cookiesConfigurer) throws IllegalStateException

      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
    • 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