Class HttpClientRequest

  • All Implemented Interfaces:
    StreamBase, WriteStream<Buffer>

    public class HttpClientRequest
    extends Object
    implements WriteStream<Buffer>
    Represents a client-side HTTP request.

    Instances are created by an HttpClient instance, via one of the methods corresponding to the specific HTTP methods, or the generic request methods. On creation the request will not have been written to the wire.

    Once a request has been obtained, headers can be set on it, and data can be written to its body if required. Once you are ready to send the request, one of the end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) methods should be called.

    Nothing is actually sent until the request has been internally assigned an HTTP connection.

    The HttpClient instance will return an instance of this class immediately, even if there are no HTTP connections available in the pool. Any requests sent before a connection is assigned will be queued internally and actually sent when an HTTP connection becomes available from the pool.

    The headers of the request are queued for writing either when the end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) method is called, or, when the first part of the body is written, whichever occurs first.

    This class supports both chunked and non-chunked HTTP.

    It implements WriteStream so it can be used with Pipe to pipe data with flow control.

    An example of using this class is as follows:

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