Class HttpClientResponse

  • All Implemented Interfaces:
    ReadStream<Buffer>, StreamBase

    public class HttpClientResponse
    extends Object
    implements ReadStream<Buffer>
    Represents a client-side HTTP response.

    Vert.x provides you with one of these via the handler that was provided when creating the HttpClientRequest or that was set on the HttpClientRequest instance.

    It implements ReadStream so it can be used with Pump to pump data with flow control.

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Constructor Detail

      • HttpClientResponse

        public HttpClientResponse​(io.vertx.core.http.HttpClientResponse delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • pipeTo

        public io.smallrye.mutiny.Uni<Void> pipeTo​(WriteStream<Buffer> dst)
        Pipe this ReadStream to the WriteStream.

        Elements emitted by this stream will be written to the write stream until this stream ends or fails.

        Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Specified by:
        pipeTo in interface ReadStream<Buffer>
        Parameters:
        dst - the destination write stream
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • pipeToAndAwait

        public Void pipeToAndAwait​(WriteStream<Buffer> dst)
        Blocking variant of io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Specified by:
        pipeToAndAwait in interface ReadStream<Buffer>
        Parameters:
        dst - the destination write stream
        Returns:
        the Void instance produced by the operation
      • version

        public io.vertx.core.http.HttpVersion version()
        Returns:
        the version of the response
      • statusCode

        public int statusCode()
        Returns:
        the status code of the response
      • statusMessage

        public String statusMessage()
        Returns:
        the status message of the response
      • headers

        public MultiMap headers()
        Returns:
        the headers
      • getHeader

        public String getHeader​(String headerName)
        Parameters:
        headerName - the header name
        Returns:
        the header value
      • getTrailer

        public String getTrailer​(String trailerName)
        Parameters:
        trailerName - the trailer name
        Returns:
        the trailer value
      • trailers

        public MultiMap trailers()
        Returns:
        the trailers
      • cookies

        public List<String> cookies()
        Returns:
        the Set-Cookie headers (including trailers)
      • bodyHandler

        public HttpClientResponse bodyHandler​(Consumer<Buffer> bodyHandler)
        Parameters:
        bodyHandler - This handler will be called after all the body has been received
        Returns:
      • customFrameHandler

        public HttpClientResponse customFrameHandler​(Consumer<HttpFrame> handler)
        Parameters:
        handler -
        Returns:
        a reference to this, so the API can be used fluently
      • netSocket

        public NetSocket netSocket()
        Returns:
        the net socket
      • streamPriorityHandler

        public HttpClientResponse streamPriorityHandler​(Consumer<io.vertx.core.http.StreamPriority> handler)
        Parameters:
        handler - the handler to be called when the stream priority changes
        Returns:
      • getHeader

        public String getHeader​(CharSequence headerName)
        Parameters:
        headerName - the header name
        Returns:
        the header value
      • pipeToAndForget

        public void pipeToAndForget​(WriteStream<Buffer> dst)
        Variant of io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream) but you don't need to compose it with other operations.

        Parameters:
        dst -
      • toBlockingStream

        public Stream<Buffer> toBlockingStream()
      • newInstance

        public static HttpClientResponse newInstance​(io.vertx.core.http.HttpClientResponse arg)