open class HttpClientRequest : WriteStream<Buffer>, ReadStream<HttpClientResponse>
Represents a client-side HTTP request.
Instances are created by an io.vertx.reactivex.core.http.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 io.vertx.reactivex.core.http.HttpClientRequest#end methods should be called.
Nothing is actually sent until the request has been internally assigned an HTTP connection.
The io.vertx.reactivex.core.http.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 io.vertx.reactivex.core.http.HttpClientRequest#end 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 io.vertx.reactivex.core.streams.WriteStream so it can be used with io.vertx.reactivex.core.streams.Pump to pump data with flow control.
An example of using this class is as follows:
NOTE: This class has been automatically generated from the io.vertx.core.http.HttpClientRequest non RX-ified interface using Vert.x codegen.
HttpClientRequest(delegate: HttpClientRequest) |
static val __TYPE_ARG: TypeArg<HttpClientRequest> |
open fun absoluteURI(): String |
|
open fun connection(): HttpConnection |
|
open fun connectionHandler(handler: Handler<HttpConnection>): HttpClientRequest
Set a connection handler called when an HTTP connection has been established. |
|
open fun continueHandler(handler: Handler<Void>): HttpClientRequest
If you send an HTTP request with the header You can then continue to write data to the request body and later end it. This is normally used in conjunction with the |
|
open fun drainHandler(handler: Handler<Void>): HttpClientRequest |
|
open fun end(chunk: String): Unit
Same as open fun end(chunk: String, enc: String): Unit
Same as open fun end(chunk: Buffer): Unit
Same as open fun end(): Unit
Ends the request. If no data has been written to the request body, and Once the request has ended, it cannot be used any more, |
|
open fun endHandler(endHandler: Handler<Void>): HttpClientRequest |
|
open fun equals(other: Any?): Boolean |
|
open fun exceptionHandler(handler: Handler<Throwable>): HttpClientRequest |
|
open fun getDelegate(): HttpClientRequest |
|
open fun getHost(): String |
|
open fun getRawMethod(): String |
|
open fun handler(handler: Handler<HttpClientResponse>): HttpClientRequest |
|
open fun hashCode(): Int |
|
open fun headers(): MultiMap |
|
open fun isChunked(): Boolean |
|
open fun method(): HttpMethod
The HTTP method for the request. |
|
open static fun newInstance(arg: HttpClientRequest): HttpClientRequest |
|
open fun path(): String |
|
open fun pause(): HttpClientRequest |
|
open fun pushHandler(handler: Handler<HttpClientRequest>): HttpClientRequest
Set a push handler for this request. The handler is called when the client receives a push promise from the server. The handler can be called multiple times, for each push promise. The handler is called with a read-only io.vertx.reactivex.core.http.HttpClientRequest, the following methods can be called:
io.vertx.reactivex.core.http.HttpClientRequest#handler method to set an handler to process the response.
|
|
open fun putHeader(name: String, value: String): HttpClientRequest
Put an HTTP header |
|
open fun query(): String |
|
open fun reset(): Boolean
Reset this stream with the error code open fun reset(code: Long): Boolean
Reset this request:
|
|
open fun resume(): HttpClientRequest |
|
open fun sendHead(): HttpClientRequest
Forces the head of the request to be written before This is normally used to implement HTTP 100-continue handling, see for more information. open fun sendHead(completionHandler: Handler<HttpVersion>): HttpClientRequest
Like |
|
open fun setChunked(chunked: Boolean): HttpClientRequest
If chunked is true then the request will be set into HTTP chunked mode |
|
open fun setFollowRedirects(followRedirects: Boolean): HttpClientRequest |
|
open fun setHost(host: String): HttpClientRequest
Set the request host. For HTTP/2 it sets the pseudo header otherwise it sets the header |
|
open fun setRawMethod(method: String): HttpClientRequest
Set the value the method to send when the method is used. |
|
open fun setTimeout(timeoutMs: Long): HttpClientRequest
Set's the amount of time after which if the request does not return any data within the timeout period an java.util.concurrent.TimeoutException will be passed to the exception handler (if provided) and the request will be closed. Calling this method more than once has the effect of canceling any existing timeout and starting the timeout from scratch. |
|
open fun setWriteQueueMaxSize(maxSize: Int): HttpClientRequest |
|
open fun streamId(): Int |
|
open fun toFlowable(): Flowable<HttpClientResponse> |
|
open fun toObservable(): Observable<HttpClientResponse> |
|
open fun toString(): String |
|
open fun uri(): String |
|
open fun write(data: Buffer): HttpClientRequestopen fun write(chunk: String): HttpClientRequest
Write a java.lang.String to the request body, encoded as UTF-8. open fun write(chunk: String, enc: String): HttpClientRequest
Write a java.lang.String to the request body, encoded using the encoding |
|
open fun writeCustomFrame(type: Int, flags: Int, payload: Buffer): HttpClientRequest
Write an HTTP/2 frame to the request, allowing to extend the HTTP/2 protocol. The frame is sent immediatly and is not subject to flow control. This method must be called after the request headers have been sent and only for the protocol HTTP/2. The open fun writeCustomFrame(frame: HttpFrame): HttpClientRequest
Like |
|
open fun writeQueueFull(): Boolean
This will return |