Interface InterceptableResponse

All Superinterfaces:
BaseResponse

public interface InterceptableResponse extends BaseResponse

An interceptable response is exposed in the InterceptableExchange to allow an exchange interceptor to provide a response when canceling the request sent by returning an empty exhange Mono.

Once a response is received from the endpoint, it becomes a proxy for the received response and it is no longer possible to modify it resulting in IllegalStateException on such operations. It might still be possible to intercept and transform the response payload publisher if it hasn't been subscribed yet.

Since:
1.6
Author:
Jeremy Kuhn
See Also:
  • Method Details

    • headers

      Configures the HTTP headers of the response to return in case the request sent is cancelled.

      Parameters:
      headersConfigurer - an outbound response headers configurer
      Returns:
      the request
      Throws:
      IllegalStateException - if the response has already been received from the endpoint
    • trailers

      InterceptableResponse trailers(Consumer<OutboundHeaders<?>> trailersConfigurer) throws IllegalStateException

      Configures the HTTP trailers of the response to return in case the request sent is cancelled.

      Parameters:
      trailersConfigurer - an outbound headers configurer
      Returns:
      the request
      Throws:
      IllegalStateException - if the response has already been received from the endpoint
    • body

      Returns the response body.

      Returns:
      the response body
    • isReceived

      boolean isReceived()

      Determines whether the response has been received from the endpoint.

      Returns:
      true if the response has been received, false otherwise