interface HttpRequest<T : Any>
A client-side HTTP request.
Instances are created by an WebClient instance, via one of the methods corresponding to the specific HTTP methods such as WebClient#get, etc...
The request shall be configured prior sending, the request is immutable and when a mutator method is called, a new request is returned allowing to expose the request in a public API and apply further customization.
After the request has been configured, the methods
#send(Handler)#sendStream(ReadStream, Handler)#sendJson(Object, Handler) ()}#sendForm(MultiMap, Handler)sendXXX methods perform the actual request, they can be called multiple times to perform the same HTTP request at different points in time.
The handler is called back with
Most of the time, this client will buffer the HTTP response fully unless a specific BodyCodec is used such as BodyCodec#create(Handler).
Author
Julien Viet
abstract fun addQueryParam(paramName: String, paramValue: String): HttpRequest<T>
Add a query parameter to the request. |
|
abstract fun <U : Any> as(responseCodec: BodyCodec<U>): HttpRequest<U>
Configure the request to decode the response with the |
|
abstract fun copy(): HttpRequest<T>
Copy this request |
|
abstract fun followRedirects(value: Boolean): HttpRequest<T>
Set wether or not to follow the directs for the request. |
|
abstract fun headers(): MultiMap |
|
abstract fun host(value: String): HttpRequest<T>
Configure the request to use a new host |
|
abstract fun method(value: HttpMethod): HttpRequest<T>
Configure the request to use a new method |
|
abstract fun port(value: Int): HttpRequest<T>
Configure the request to use a new port |
|
abstract fun putHeader(name: String, value: String): HttpRequest<T>
Configure the request to add a new HTTP header. |
|
abstract fun queryParams(): MultiMap
Return the current query parameters. |
|
abstract fun send(handler: Handler<AsyncResult<HttpResponse<T>>>): Unit
Send a request, the |
|
abstract fun sendBuffer(body: Buffer, handler: Handler<AsyncResult<HttpResponse<T>>>): Unit
Like |
|
abstract fun sendForm(body: MultiMap, handler: Handler<AsyncResult<HttpResponse<T>>>): Unit
Like When the content type header is previously set to |
|
abstract fun sendJson(body: Any, handler: Handler<AsyncResult<HttpResponse<T>>>): Unit
Like |
|
abstract fun sendJsonObject(body: JsonObject, handler: Handler<AsyncResult<HttpResponse<T>>>): Unit
Like |
|
abstract fun sendStream(body: ReadStream<Buffer>, handler: Handler<AsyncResult<HttpResponse<T>>>): Unit
Like |
|
abstract fun setQueryParam(paramName: String, paramValue: String): HttpRequest<T>
Set a query parameter to the request. |
|
abstract fun ssl(value: Boolean): HttpRequest<T> |
|
abstract fun timeout(value: Long): HttpRequest<T>
Configures the amount of time in milliseconds after which if the request does not return any data within the timeout period an java.util.concurrent.TimeoutException fails the request. Setting zero or a negative |
|
abstract fun uri(value: String): HttpRequest<T>
Configure the request to use a new request URI When the uri has query parameters, they are set in the |
|
abstract fun virtualHost(value: String): HttpRequest<T>
Configure the request to use a virtual host |