Interface HttpClientResponse

All Superinterfaces:
AutoCloseable

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

    Modifier and Type
    Method
    Description
    default <T> T
    as(Class<T> type)
    Read the entity as a specific type.
    void
    Closes the response.
    io.helidon.http.media.ReadableEntity
    Response entity.
    io.helidon.http.ClientResponseHeaders
    Response headers.
    default InputStream
    Entity input stream.
    URI of the last request.
    default <T extends Source<?>>
    void
    source(io.helidon.common.GenericType<T> sourceType, T source)
    Registers a source listener for this response.
    io.helidon.http.Status
    Response status.
    io.helidon.http.ClientResponseTrailers
    Response trailer headers.
  • Method Details

    • entity

      io.helidon.http.media.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(io.helidon.common.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

      io.helidon.http.Status status()
      Response status.
      Returns:
      status
    • headers

      io.helidon.http.ClientResponseHeaders headers()
      Response headers.
      Returns:
      headers
    • trailers

      io.helidon.http.ClientResponseTrailers 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