Interface HttpClientResponse

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
Http1ClientResponse, Http2ClientResponse

public interface HttpClientResponse extends AutoCloseable
Http client response.
  • Method Details

    • entity

      ReadableEntity entity()
      Response entity.
      Returns:
      entity
    • inputStream

      default InputStream inputStream()
      Entity input stream. This is a shortcut to entity() and ReadableEntity.inputStream().
      Returns:
      input stream
    • as

      default <T> T as(Class<T> type)
      Read the entity as a specific type. This is a shortcut to entity() and ReadableEntity.as(Class).
      Type Parameters:
      T - type of the entity
      Parameters:
      type - class of the entity
      Returns:
      typed entity
    • source

      default <T extends Source<?>> void source(GenericType<T> sourceType, T source)
      Registers a source listener for this response.
      Type Parameters:
      T - the actual source type
      Parameters:
      sourceType - the generic source type
      source - the source
      Throws:
      UnsupportedOperationException - if operation not implemented on this response or not provider for this listener is found
    • close

      void close()
      Closes the response. This may have no impact on the underlying connection. Response is implicitly closed if the entity is fully read (either through entity() or through inputStream().
      Specified by:
      close in interface AutoCloseable
    • status

      Status status()
      Response status.
      Returns:
      status
    • headers

      Response headers.
      Returns:
      headers
    • trailers

      Response trailer headers. Blocks until trailers are available.
      Returns:
      trailers
      Throws:
      IllegalStateException - when invoked before entity is requested
    • lastEndpointUri

      ClientUri lastEndpointUri()
      URI of the last request. (after redirection)
      Returns:
      last URI