io.vertx.reactivex.ext.web.client

## Class HttpRequest<T>

- java.lang.Object
- - io.vertx.reactivex.ext.web.client.HttpRequest<T>

-     public class HttpRequest<T>
      extends Object

  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(java.lang.String)`, 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(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)`
  - `sendStream(io.vertx.reactivex.core.streams.ReadStream<io.vertx.reactivex.core.buffer.Buffer>, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)`
  - `sendJson(java.lang.Object, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` ()}
  - `sendForm(io.vertx.reactivex.core.MultiMap, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)`
  can be called. The `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

  - an `HttpResponse` instance when the HTTP response has been received
  - a failure when the HTTP request failed (like a connection error) or when the HTTP response could not be obtained (like connection or unmarshalling errors)

  Most of the time, this client will buffer the HTTP response fully unless a specific is used such as .

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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<HttpRequest>` | `__TYPE_ARG`
    `io.vertx.lang.rx.TypeArg<T>` | `__typeArg_0`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpRequest(HttpRequest delegate)`
    `HttpRequest(HttpRequest delegate, io.vertx.lang.rx.TypeArg<T> typeArg_0)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `HttpRequest<T>` | `addQueryParam(String paramName, String paramValue)` Add a query parameter to the request.
    `<U> HttpRequest<U>` | `as(BodyCodec<U> responseCodec)` Configure the request to decode the response with the `responseCodec`.
    `HttpRequest<T>` | `basicAuthentication(Buffer id, Buffer password)` Configure the request to perform basic access authentication.
    `HttpRequest<T>` | `basicAuthentication(String id, String password)` Configure the request to perform basic access authentication.
    `HttpRequest<T>` | `bearerTokenAuthentication(String bearerToken)` Configure the request to perform bearer token authentication.
    `HttpRequest<T>` | `copy()` Copy this request
    `boolean` | `equals(Object o)`
    `HttpRequest<T>` | `expect(java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult> predicate)` Add an expectation that the response is valid according to the provided `predicate`.
    `HttpRequest<T>` | `expect(ResponsePredicate predicate)` Add an expectation that the response is valid according to the provided `predicate`.
    `HttpRequest<T>` | `followRedirects(boolean value)` Set wether or not to follow the directs for the request.
    `HttpRequest` | `getDelegate()`
    `int` | `hashCode()`
    `MultiMap` | `headers()`
    `HttpRequest<T>` | `host(String value)` Configure the request to use a new host `value`.
    `HttpRequest<T>` | `method(HttpMethod value)` Configure the request to use a new method `value`.
    `HttpRequest<T>` | `multipartMixed(boolean allow)` Allow or disallow multipart mixed encoding when sending having files sharing the same file name.
    `static <T> HttpRequest<T>` | `newInstance(HttpRequest arg)`
    `static <T> HttpRequest<T>` | `newInstance(HttpRequest arg, io.vertx.lang.rx.TypeArg<T> __typeArg_T)`
    `HttpRequest<T>` | `port(int value)` Configure the request to use a new port `value`.
    `HttpRequest<T>` | `putHeader(String name, String value)` Configure the request to add a new HTTP header.
    `HttpRequest<T>` | `putHeaders(MultiMap headers)` Configure the request to add multiple HTTP headers .
    `MultiMap` | `queryParams()` Return the current query parameters.
    `HttpRequest<T>` | `rawMethod(String method)` Configure the request to use a custom HTTP method
    `Single<HttpResponse<T>>` | `rxSend()` Send a request, the `handler` will receive the response as an `HttpResponse`.
    `Single<HttpResponse<T>>` | `rxSendBuffer(Buffer body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` buffer.
    `Single<HttpResponse<T>>` | `rxSendForm(MultiMap body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` multimap encoded as form and the content type set to `application/x-www-form-urlencoded`.
    `Single<HttpResponse<T>>` | `rxSendJson(Object body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
    `Single<HttpResponse<T>>` | `rxSendJsonObject(JsonObject body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
    `Single<HttpResponse<T>>` | `rxSendMultipartForm(MultipartForm body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` multimap encoded as form and the content type set to `multipart/form-data`.
    `Single<HttpResponse<T>>` | `rxSendStream(Flowable<Buffer> body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
    `Single<HttpResponse<T>>` | `rxSendStream(Observable<Buffer> body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
    `Single<HttpResponse<T>>` | `rxSendStream(ReadStream<Buffer> body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
    `void` | `send(Handler<AsyncResult<HttpResponse<T>>> handler)` Send a request, the `handler` will receive the response as an `HttpResponse`.
    `void` | `sendBuffer(Buffer body, Handler<AsyncResult<HttpResponse<T>>> handler)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` buffer.
    `void` | `sendForm(MultiMap body, Handler<AsyncResult<HttpResponse<T>>> handler)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` multimap encoded as form and the content type set to `application/x-www-form-urlencoded`.
    `void` | `sendJson(Object body, Handler<AsyncResult<HttpResponse<T>>> handler)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
    `void` | `sendJsonObject(JsonObject body, Handler<AsyncResult<HttpResponse<T>>> handler)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
    `void` | `sendMultipartForm(MultipartForm body, Handler<AsyncResult<HttpResponse<T>>> handler)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` multimap encoded as form and the content type set to `multipart/form-data`.
    `void` | `sendStream(Flowable<Buffer> body, Handler<AsyncResult<HttpResponse<T>>> handler)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
    `void` | `sendStream(Observable<Buffer> body, Handler<AsyncResult<HttpResponse<T>>> handler)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
    `void` | `sendStream(ReadStream<Buffer> body, Handler<AsyncResult<HttpResponse<T>>> handler)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
    `HttpRequest<T>` | `setQueryParam(String paramName, String paramValue)` Set a query parameter to the request.
    `HttpRequest<T>` | `ssl(Boolean value)`
    `HttpRequest<T>` | `timeout(long value)` Configures the amount of time in milliseconds after which if the request does not return any data within the timeout period an `TimeoutException` fails the request.
    `String` | `toString()`
    `HttpRequest<T>` | `uri(String value)` Configure the request to use a new request URI `value`.
    `HttpRequest<T>` | `virtualHost(String value)` Configure the request to use a virtual host `value`.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<HttpRequest> __TYPE_ARG

    - #### __typeArg_0

          public final io.vertx.lang.rx.TypeArg<T> __typeArg_0

  - ### Constructor Detail

    - #### HttpRequest

          public HttpRequest(HttpRequest delegate)

    - #### HttpRequest

          public HttpRequest(HttpRequest delegate,
                             io.vertx.lang.rx.TypeArg<T> typeArg_0)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public HttpRequest getDelegate()

    - #### method

          public HttpRequest<T> method(HttpMethod value)

      Configure the request to use a new method `value`.
      Parameters:
        `value` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### rawMethod

          public HttpRequest<T> rawMethod(String method)

      Configure the request to use a custom HTTP method
      Parameters:
        `method` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### port

          public HttpRequest<T> port(int value)

      Configure the request to use a new port `value`.
      Parameters:
        `value` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### as

          public <U> HttpRequest<U> as(BodyCodec<U> responseCodec)

      Configure the request to decode the response with the `responseCodec`.
      Parameters:
        `responseCodec` - the response codec
      Returns:
        a reference to this, so the API can be used fluently

    - #### host

          public HttpRequest<T> host(String value)

      Configure the request to use a new host `value`.
      Parameters:
        `value` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### virtualHost

          public HttpRequest<T> virtualHost(String value)

      Configure the request to use a virtual host `value`.

      Usually the header host (:authority pseudo header for HTTP/2) is set from the request host value since this host value resolves to the server IP address.

      Sometimes you need to set a host header for an address that does not resolve to the server IP address. The virtual host value overrides the value of the actual host header (:authority pseudo header for HTTP/2).

      The virtual host is also be used for SNI.
      Parameters:
        `value` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### uri

          public HttpRequest<T> uri(String value)

      Configure the request to use a new request URI `value`.

      When the uri has query parameters, they are set in the `queryParams()` multimap, overwritting any parameters previously set.

      Parameters:
        `value` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### putHeaders

          public HttpRequest<T> putHeaders(MultiMap headers)

      Configure the request to add multiple HTTP headers .
      Parameters:
        `headers` - The HTTP headers
      Returns:
        a reference to this, so the API can be used fluently

    - #### putHeader

          public HttpRequest<T> putHeader(String name,
                                          String value)

      Configure the request to add a new HTTP header.
      Parameters:
        `name` - the header name
        `value` - the header value
      Returns:
        a reference to this, so the API can be used fluently

    - #### headers

          public MultiMap headers()

      Returns:
        The HTTP headers

    - #### basicAuthentication

          public HttpRequest<T> basicAuthentication(String id,
                                                    String password)

      Configure the request to perform basic access authentication.

      In basic HTTP authentication, a request contains a header field of the form 'Authorization: Basic <credentials>', where credentials is the base64 encoding of id and password joined by a colon.

      Parameters:
        `id` - the id
        `password` - the password
      Returns:
        a reference to this, so the API can be used fluently

    - #### basicAuthentication

          public HttpRequest<T> basicAuthentication(Buffer id,
                                                    Buffer password)

      Configure the request to perform basic access authentication.

      In basic HTTP authentication, a request contains a header field of the form 'Authorization: Basic <credentials>', where credentials is the base64 encoding of id and password joined by a colon.

      Parameters:
        `id` - the id
        `password` - the password
      Returns:
        a reference to this, so the API can be used fluently

    - #### bearerTokenAuthentication

          public HttpRequest<T> bearerTokenAuthentication(String bearerToken)

      Configure the request to perform bearer token authentication.

      In OAuth 2.0, a request contains a header field of the form 'Authorization: Bearer <bearerToken>', where bearerToken is the bearer token issued by an authorization server to access protected resources.

      Parameters:
        `bearerToken` - the bearer token
      Returns:
        a reference to this, so the API can be used fluently

    - #### ssl

          public HttpRequest<T> ssl(Boolean value)

    - #### timeout

          public HttpRequest<T> timeout(long value)

      Configures the amount of time in milliseconds after which if the request does not return any data within the timeout period an `TimeoutException` fails the request.

      Setting zero or a negative `value` disables the timeout.

      Parameters:
        `value` - The quantity of time in milliseconds.
      Returns:
        a reference to this, so the API can be used fluently

    - #### addQueryParam

          public HttpRequest<T> addQueryParam(String paramName,
                                              String paramValue)

      Add a query parameter to the request.
      Parameters:
        `paramName` - the param name
        `paramValue` - the param value
      Returns:
        a reference to this, so the API can be used fluently

    - #### setQueryParam

          public HttpRequest<T> setQueryParam(String paramName,
                                              String paramValue)

      Set a query parameter to the request.
      Parameters:
        `paramName` - the param name
        `paramValue` - the param value
      Returns:
        a reference to this, so the API can be used fluently

    - #### followRedirects

          public HttpRequest<T> followRedirects(boolean value)

      Set wether or not to follow the directs for the request.
      Parameters:
        `value` - true if redirections should be followed
      Returns:
        a reference to this, so the API can be used fluently

    - #### expect

          public HttpRequest<T> expect(java.util.function.Function<HttpResponse<Void>,ResponsePredicateResult> predicate)

      Add an expectation that the response is valid according to the provided `predicate`.

      Multiple predicates can be added.

      Parameters:
        `predicate` - the predicate
      Returns:
        a reference to this, so the API can be used fluently

    - #### expect

          public HttpRequest<T> expect(ResponsePredicate predicate)

      Add an expectation that the response is valid according to the provided `predicate`.

      Multiple predicates can be added.

      Parameters:
        `predicate` - the predicate
      Returns:
        a reference to this, so the API can be used fluently

    - #### queryParams

          public MultiMap queryParams()

      Return the current query parameters.
      Returns:
        the current query parameters

    - #### copy

          public HttpRequest<T> copy()

      Copy this request
      Returns:
        a copy of this request

    - #### multipartMixed

          public HttpRequest<T> multipartMixed(boolean allow)

      Allow or disallow multipart mixed encoding when sending having files sharing the same file name.
      The default value is `true`.
      Set to `false` if you want to achieve the behavior for HTML5.
      Parameters:
        `allow` - `true` allows use of multipart mixed encoding
      Returns:
        a reference to this, so the API can be used fluently

    - #### sendStream

          public void sendStream(ReadStream<Buffer> body,
                                 Handler<AsyncResult<HttpResponse<T>>> handler)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
      Parameters:
        `body` - the body
        `handler` -

    - #### rxSendStream

          public Single<HttpResponse<T>> rxSendStream(ReadStream<Buffer> body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
      Parameters:
        `body` - the body
      Returns:

    - #### sendStream

          public void sendStream(Flowable<Buffer> body,
                                 Handler<AsyncResult<HttpResponse<T>>> handler)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
      Parameters:
        `body` - the body
        `handler` -

    - #### rxSendStream

          public Single<HttpResponse<T>> rxSendStream(Flowable<Buffer> body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
      Parameters:
        `body` - the body
      Returns:

    - #### sendStream

          public void sendStream(Observable<Buffer> body,
                                 Handler<AsyncResult<HttpResponse<T>>> handler)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
      Parameters:
        `body` - the body
        `handler` -

    - #### rxSendStream

          public Single<HttpResponse<T>> rxSendStream(Observable<Buffer> body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
      Parameters:
        `body` - the body
      Returns:

    - #### sendBuffer

          public void sendBuffer(Buffer body,
                                 Handler<AsyncResult<HttpResponse<T>>> handler)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` buffer.
      Parameters:
        `body` - the body
        `handler` -

    - #### rxSendBuffer

          public Single<HttpResponse<T>> rxSendBuffer(Buffer body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` buffer.
      Parameters:
        `body` - the body
      Returns:

    - #### sendJsonObject

          public void sendJsonObject(JsonObject body,
                                     Handler<AsyncResult<HttpResponse<T>>> handler)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
      Parameters:
        `body` - the body
        `handler` -

    - #### rxSendJsonObject

          public Single<HttpResponse<T>> rxSendJsonObject(JsonObject body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
      Parameters:
        `body` - the body
      Returns:

    - #### sendJson

          public void sendJson(Object body,
                               Handler<AsyncResult<HttpResponse<T>>> handler)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
      Parameters:
        `body` - the body
        `handler` -

    - #### rxSendJson

          public Single<HttpResponse<T>> rxSendJson(Object body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
      Parameters:
        `body` - the body
      Returns:

    - #### sendForm

          public void sendForm(MultiMap body,
                               Handler<AsyncResult<HttpResponse<T>>> handler)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` multimap encoded as form and the content type set to `application/x-www-form-urlencoded`.

      When the content type header is previously set to `multipart/form-data` it will be used instead.

      Parameters:
        `body` - the body
        `handler` -

    - #### rxSendForm

          public Single<HttpResponse<T>> rxSendForm(MultiMap body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` multimap encoded as form and the content type set to `application/x-www-form-urlencoded`.

      When the content type header is previously set to `multipart/form-data` it will be used instead.

      Parameters:
        `body` - the body
      Returns:

    - #### sendMultipartForm

          public void sendMultipartForm(MultipartForm body,
                                        Handler<AsyncResult<HttpResponse<T>>> handler)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` multimap encoded as form and the content type set to `multipart/form-data`. You may use this method to send attributes and upload files.
      Parameters:
        `body` - the body
        `handler` -

    - #### rxSendMultipartForm

          public Single<HttpResponse<T>> rxSendMultipartForm(MultipartForm body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` multimap encoded as form and the content type set to `multipart/form-data`. You may use this method to send attributes and upload files.
      Parameters:
        `body` - the body
      Returns:

    - #### send

          public void send(Handler<AsyncResult<HttpResponse<T>>> handler)

      Send a request, the `handler` will receive the response as an `HttpResponse`.
      Parameters:
        `handler` -

    - #### rxSend

          public Single<HttpResponse<T>> rxSend()

      Send a request, the `handler` will receive the response as an `HttpResponse`.
      Returns:

    - #### newInstance

          public static <T> HttpRequest<T> newInstance(HttpRequest arg)

    - #### newInstance

          public static <T> HttpRequest<T> newInstance(HttpRequest arg,
                                                       io.vertx.lang.rx.TypeArg<T> __typeArg_T)

Copyright © 2019 Eclipse. All rights reserved.