io.vertx.rxjava.ext.web.client

## Class HttpRequest<T>

- java.lang.Object
- - io.vertx.rxjava.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.rxjava.ext.web.client.HttpResponse<T>>>)`
  - `sendStream(io.vertx.rxjava.core.streams.ReadStream<io.vertx.rxjava.core.buffer.Buffer>, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.web.client.HttpResponse<T>>>)`
  - `sendJson(java.lang.Object, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.web.client.HttpResponse<T>>>)` ()}
  - `sendForm(io.vertx.rxjava.core.MultiMap, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.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 TypeArg<HttpRequest>` | `__TYPE_ARG`
    `TypeArg<T>` | `__typeArg_0`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpRequest(HttpRequest delegate)`
    `HttpRequest(HttpRequest delegate, 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>` | `copy()` Copy this request
    `HttpRequest<T>` | `followRedirects(boolean value)` Set wether or not to follow the directs for the request.
    `HttpRequest` | `getDelegate()`
    `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`.
    `static <T> HttpRequest` | `newInstance(HttpRequest arg)`
    `static <T> HttpRequest` | `newInstance(HttpRequest arg, 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.
    `MultiMap` | `queryParams()` Return the current query parameters.
    `rx.Single<HttpResponse<T>>` | `rxSend()` Send a request, the `handler` will receive the response as an `HttpResponse`.
    `rx.Single<HttpResponse<T>>` | `rxSendBuffer(Buffer body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` buffer.
    `rx.Single<HttpResponse<T>>` | `rxSendForm(MultiMap body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.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`.
    `rx.Single<HttpResponse<T>>` | `rxSendJson(Object body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
    `rx.Single<HttpResponse<T>>` | `rxSendJsonObject(JsonObject body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
    `rx.Single<HttpResponse<T>>` | `rxSendStream(rx.Observable<Buffer> body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` stream.
    `rx.Single<HttpResponse<T>>` | `rxSendStream(ReadStream<Buffer> body)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.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.rxjava.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.rxjava.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.rxjava.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.rxjava.ext.web.client.HttpResponse<T>>>)` but with an HTTP request `body` object encoded as json and the content type set to `application/json`.
    `void` | `sendStream(rx.Observable<Buffer> body, Handler<AsyncResult<HttpResponse<T>>> handler)` Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.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.rxjava.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.
    `HttpRequest<T>` | `uri(String value)` Configure the request to use a new request URI `value`.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final TypeArg<HttpRequest> __TYPE_ARG

    - #### __typeArg_0

          public final TypeArg<T> __typeArg_0

  - ### Constructor Detail

    - #### HttpRequest

          public HttpRequest(HttpRequest delegate)

    - #### HttpRequest

          public HttpRequest(HttpRequest delegate,
                             TypeArg<T> typeArg_0)

  - ### Method Detail

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### 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

    - #### sendStream

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

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

    - #### rxSendStream

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

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

    - #### rxSendBuffer

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

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.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.rxjava.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 rx.Single<HttpResponse<T>> rxSendJsonObject(JsonObject body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.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.rxjava.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 rx.Single<HttpResponse<T>> rxSendJson(Object body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.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.rxjava.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 rx.Single<HttpResponse<T>> rxSendForm(MultiMap body)

      Like `send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.rxjava.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:

    - #### 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 rx.Single<HttpResponse<T>> rxSend()

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

    - #### sendStream

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

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

    - #### rxSendStream

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

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

    - #### newInstance

          public static <T> HttpRequest newInstance(HttpRequest arg)

    - #### newInstance

          public static <T> HttpRequest newInstance(HttpRequest arg,
                                                    TypeArg<T> __typeArg_T)

Copyright © 2017. All rights reserved.