Packages

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

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. * @param 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. * @param 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 basicAuthentication(id: Buffer, password: Buffer): HttpRequest[T]

    Configure the request to perform basic access authentication.

    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. * @param id the id

    password

    the password

    returns

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

  9. def basicAuthentication(id: String, password: String): HttpRequest[T]

    Configure the request to perform basic access authentication.

    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. * @param id the id

    password

    the password

    returns

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

  10. def bearerTokenAuthentication(bearerToken: String): HttpRequest[T]

    Configure the request to perform bearer token authentication.

    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. * @param bearerToken the bearer token

    returns

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

  11. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  12. def copy(): HttpRequest[T]

    Copy this request * @return a copy of this request

  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def expect(predicate: ResponsePredicate): HttpRequest[T]

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

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

    Multiple predicates can be added. * @param predicate the predicate

    returns

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

  16. def expect(predicate: (HttpResponse[Unit]) ⇒ ResponsePredicateResult): HttpRequest[T]

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

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

    Multiple predicates can be added. * @param predicate the predicate

    returns

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

  17. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. 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. * @param value true if redirections should be followed

    returns

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

  19. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  20. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. def headers(): MultiMap

    returns

    The HTTP headers

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

    Configure the request to use a new host value.

    Configure the request to use a new host value. * @return a reference to this, so the API can be used fluently

  23. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  24. def method(value: HttpMethod): HttpRequest[T]

    Configure the request to use a new method value.

    Configure the request to use a new method value. * @return a reference to this, so the API can be used fluently

  25. def multipartMixed(allow: Boolean): HttpRequest[T]

    Allow or disallow multipart mixed encoding when sending having files sharing the same file name.

    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. * @param allow true allows use of multipart mixed encoding

    returns

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

  26. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  29. def port(value: Int): HttpRequest[T]

    Configure the request to use a new port value.

    Configure the request to use a new port value. * @return a reference to this, so the API can be used fluently

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

    Configure the request to set a new HTTP header.

    Configure the request to set a new HTTP header. * @param name the header name

    value

    the header value

    returns

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

  31. def putHeaders(headers: MultiMap): HttpRequest[T]

    Configure the request to add multiple HTTP headers .

    Configure the request to add multiple HTTP headers . * @param headers The HTTP headers

    returns

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

  32. def queryParams(): MultiMap

    Return the current query parameters.

    Return the current query parameters. * @return the current query parameters

  33. def rawMethod(method: String): HttpRequest[T]

    Configure the request to use a custom HTTP method * @return a reference to this, so the API can be used fluently

  34. 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.

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

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

    Like io.vertx.scala.ext.web.client.HttpRequest#send but with an HTTP request body buffer. * @param body the body

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

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

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

    Like io.vertx.scala.ext.web.client.HttpRequest#send 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#send 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. * @param body the body

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

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

  39. def sendFuture(): Future[HttpResponse[T]]

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

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

    Like io.vertx.scala.ext.web.client.HttpRequest#send 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#send but with an HTTP request body object encoded as json and the content type set to application/json. * @param body the body

  41. def sendJsonFuture(body: Option[AnyRef]): Future[HttpResponse[T]]

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

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

    Like io.vertx.scala.ext.web.client.HttpRequest#send 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#send but with an HTTP request body object encoded as json and the content type set to application/json. * @param body the body

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

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

  44. def sendMultipartForm(body: MultipartForm, handler: Handler[AsyncResult[HttpResponse[T]]]): Unit

    Like io.vertx.scala.ext.web.client.HttpRequest#send but with an HTTP request body multimap encoded as form and the content type set to multipart/form-data.

    Like io.vertx.scala.ext.web.client.HttpRequest#send 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. * @param body the body

  45. def sendMultipartFormFuture(body: MultipartForm): Future[HttpResponse[T]]

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

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

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

    Like io.vertx.scala.ext.web.client.HttpRequest#send but with an HTTP request body stream. * @param body the body

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

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

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

    Set a query parameter to the request.

    Set a query parameter to the request. * @param paramName the param name

    paramValue

    the param value

    returns

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

  49. def ssl(value: Boolean): HttpRequest[T]
  50. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  51. 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. * @param value The quantity of time in milliseconds.

    returns

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

  52. def toString(): String
    Definition Classes
    AnyRef → Any
  53. 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. * @return a reference to this, so the API can be used fluently

  54. def virtualHost(value: String): HttpRequest[T]

    Configure the request to use a virtual host 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. * @return a reference to this, so the API can be used fluently

  55. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped