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 have been sent to the client, will result in an IllegalStateException being thrown.

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

      int getTransferedLength()

      Returns the number of bytes transfered as part of the response body.

      Returns:
      the transfered length
    • 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
    • sendContinue

      Response sendContinue() throws IllegalStateException

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