vertx-lang-scala-docs_2.12 3.4.1 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package ext
  Definition Classes
    scala
-  package web
  Definition Classes
    ext
-  package client
  Definition Classes
    web
- HttpRequest
- HttpResponse
- WebClient
- WebClientOptions

c

io.vertx.scala.ext.web.client

# HttpRequest 

###
Companion object HttpRequest

#### class HttpRequest[T] extends AnyRef

A client-side HTTP request.

Instances are created by an io.vertx.scala.ext.web.client.WebClient instance, via one of the methods corresponding to the specific HTTP methods such as io.vertx.scala.ext.web.client.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

- io.vertx.scala.ext.web.client.HttpRequest#sendFuture
- io.vertx.scala.ext.web.client.HttpRequest#sendStreamFuture
- io.vertx.scala.ext.web.client.HttpRequest#sendJsonFuture ()}
- io.vertx.scala.ext.web.client.HttpRequest#sendFormFuture

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 io.vertx.scala.ext.web.client.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 .

Linear Supertypes
AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. HttpRequest
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new HttpRequest(_asJava: AnyRef)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T])

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  def addQueryParam(paramName: String, paramValue: String): HttpRequest[T]

   Add a query parameter to the request.

   Add a query parameter to the request.

   paramName

     the param name

   paramValue

     the param value

   returns

     a reference to this, so the API can be used fluently

5.  def as[U](responseCodec: BodyCodec[U])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[U]): HttpRequest[U]

   Configure the request to decode the response with the `responseCodec`.

   Configure the request to decode the response with the `responseCodec`.

   responseCodec

     the response codec

   returns

     a reference to this, so the API can be used fluently

6.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
7.  def asJava: AnyRef
8.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... )
9.  def copy(): HttpRequest[T]

   Copy this request

   Copy this request

   returns

     a copy of this request

10.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
11.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
12.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
13.  def followRedirects(value: Boolean): HttpRequest[T]

    Set wether or not to follow the directs for the request.

    Set wether or not to follow the directs for the request.

    value

      true if redirections should be followed

    returns

      a reference to this, so the API can be used fluently

14.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
15.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
16.  def headers(): MultiMap

    returns

      The HTTP headers

17.  def host(value: String): HttpRequest[T]

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

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

    returns

      a reference to this, so the API can be used fluently

18.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
19.  def method(value: HttpMethod): HttpRequest[T]

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

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

    returns

      a reference to this, so the API can be used fluently

20.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
21.  final def notify(): Unit
    Definition Classes
      AnyRef
22.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
23.  def port(value: Int): HttpRequest[T]

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

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

    returns

      a reference to this, so the API can be used fluently

24.  def putHeader(name: String, value: String): HttpRequest[T]

    Configure the request to add a new HTTP header.

    Configure the request to add a new HTTP header.

    name

      the header name

    value

      the header value

    returns

      a reference to this, so the API can be used fluently

25.  def queryParams(): MultiMap

    Return the current query parameters.

    Return the current query parameters.

    returns

      the current query parameters

26.  def send(handler: Handler[AsyncResult[HttpResponse[T]]]): Unit

    Send a request, the `handler` will receive the response as an io.vertx.scala.ext.web.client.HttpResponse.

27.  def sendBuffer(body: Buffer, handler: Handler[AsyncResult[HttpResponse[T]]]): Unit

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture but with an HTTP request `body` buffer.

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture but with an HTTP request `body` buffer.

    body

      the body

28.  def sendBufferFuture(body: Buffer): Future[HttpResponse[T]]

    Like sendBuffer but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

29.  def sendForm(body: MultiMap, handler: Handler[AsyncResult[HttpResponse[T]]]): Unit

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture but with an HTTP request `body` multimap encoded as form and the content type set to `application/x-www-form-urlencoded`.

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture 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.

    body

      the body

30.  def sendFormFuture(body: MultiMap): Future[HttpResponse[T]]

    Like sendForm but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

31.  def sendFuture(): Future[HttpResponse[T]]

    Like send but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

32.  def sendJson(body: AnyRef, handler: Handler[AsyncResult[HttpResponse[T]]]): Unit

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture but with an HTTP request `body` object encoded as json and the content type set to `application/json`.

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture but with an HTTP request `body` object encoded as json and the content type set to `application/json`.

    body

      the body

33.  def sendJsonFuture(body: AnyRef): Future[HttpResponse[T]]

    Like sendJson but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

34.  def sendJsonObject(body: JsonObject, handler: Handler[AsyncResult[HttpResponse[T]]]): Unit

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture but with an HTTP request `body` object encoded as json and the content type set to `application/json`.

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture but with an HTTP request `body` object encoded as json and the content type set to `application/json`.

    body

      the body

35.  def sendJsonObjectFuture(body: JsonObject): Future[HttpResponse[T]]

    Like sendJsonObject but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

36.  def sendStream(body: ReadStream[Buffer], handler: Handler[AsyncResult[HttpResponse[T]]]): Unit

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture but with an HTTP request `body` stream.

    Like io.vertx.scala.ext.web.client.HttpRequest#sendFuture but with an HTTP request `body` stream.

    body

      the body

37.  def sendStreamFuture(body: ReadStream[Buffer]): Future[HttpResponse[T]]

    Like sendStream but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

38.  def setQueryParam(paramName: String, paramValue: String): HttpRequest[T]

    Set a query parameter to the request.

    Set a query parameter to the request.

    paramName

      the param name

    paramValue

      the param value

    returns

      a reference to this, so the API can be used fluently

39.  def ssl(value: Boolean): HttpRequest[T]
40.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
41.  def 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 TimeoutException fails the request.

    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.

    value

      The quantity of time in milliseconds.

    returns

      a reference to this, so the API can be used fluently

42.  def toString(): String
    Definition Classes
      AnyRef → Any
43.  def uri(value: String): HttpRequest[T]

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

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

    When the uri has query parameters, they are set in the io.vertx.scala.ext.web.client.HttpRequest#queryParams multimap, overwritting any parameters previously set.

    returns

      a reference to this, so the API can be used fluently

44.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
45.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
46.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

### Inherited from AnyRef

### Inherited from Any

### Ungrouped