org.vertx.scala.core.http

HttpClient

final class HttpClient extends Self with TCPSupport with ClientSSLSupport

An HTTP client that maintains a pool of connections to a specific host, at a specific port. The client supports pipelining of requests.

As well as HTTP requests, the client can act as a factory for WebSocket websockets.

If an instance is instantiated from an event loop then the handlers of the instance will always be called on that same event loop. If an instance is instantiated from some other arbitrary Java thread (i.e. when running embedded) then and event loop will be assigned to the instance and used when any of its handlers are called.

Instances of HttpClient are thread-safe.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. HttpClient
  2. ClientSSLSupport
  3. SSLSupport
  4. TCPSupport
  5. NetworkSupport
  6. AsJava
  7. Self
  8. AnyRef
  9. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. type J = java.core.http.HttpClient

    The internal type of the Java wrapped class.

    The internal type of the Java wrapped class.

    Definition Classes
    HttpClientClientSSLSupportSSLSupportTCPSupportNetworkSupport → AsJava

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. val asJava: java.core.http.HttpClient

    The internal instance of the Java wrapped class.

    The internal instance of the Java wrapped class.

    Definition Classes
    HttpClient → AsJava
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def close(): Unit

    Close the HTTP client.

    Close the HTTP client. This will cause any pooled HTTP connections to be closed.

  10. def connect(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP CONNECT request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP CONNECT request with the specified uri.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  11. def connectWebsocket(uri: String, wsVersion: WebSocketVersion, headers: MultiMap, wsConnect: (WebSocket) ⇒ Unit): HttpClient

    Attempt to connect an HTML5 websocket to the specified URI

    Attempt to connect an HTML5 websocket to the specified URI

    This version of the method allows you to specify the websockets version using the wsVersion parameter You can also specify a set of headers to append to the upgrade request The connect is done asynchronously and wsConnect is called back with the websocket

  12. def connectWebsocket(uri: String, wsVersion: WebSocketVersion, wsConnect: (WebSocket) ⇒ Unit): HttpClient

    Attempt to connect an HTML5 websocket to the specified URI

    Attempt to connect an HTML5 websocket to the specified URI

    This version of the method allows you to specify the websockets version using the wsVersion parameter The connect is done asynchronously and wsConnect is called back with the websocket

  13. def connectWebsocket(uri: String, wsConnect: (WebSocket) ⇒ Unit): HttpClient

    Attempt to connect an HTML5 websocket to the specified URI

    Attempt to connect an HTML5 websocket to the specified URI

    The connect is done asynchronously and wsConnect is called back with the websocket

  14. def delete(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP DELETE request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP DELETE request with the specified uri.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  15. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  17. def exceptionHandler(handler: (Throwable) ⇒ Unit): HttpClient

    Set an exception handler

    Set an exception handler

    returns

    A reference to this, so multiple invocations can be chained together.

  18. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. def get(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP GET request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP GET request with the specified uri.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  20. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  21. def getConnectTimeout: Int

    returns

    The connect timeout in milliseconds

  22. def getHost: String

    returns

    The host

  23. def getKeyStorePassword: String

    returns

    Get the key store password

    Definition Classes
    SSLSupport
  24. def getKeyStorePath: String

    returns

    Get the key store path

    Definition Classes
    SSLSupport
  25. def getMaxPoolSize: Int

    Returns the maximum number of connections in the pool

  26. def getMaxWebSocketFrameSize: Int

    Get the maximum websocket frame size in bytes.

  27. def getNow(uri: String, headers: MultiMap, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClient

    This method works in the same manner as org.vertx.java.core.Handler), except that it allows you specify a set of headers that will be sent with the request.

  28. def getNow(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClient

    This is a quick version of the org.vertx.java.core.Handler) method where you do not want to do anything with the request before sending.

    This is a quick version of the org.vertx.java.core.Handler) method where you do not want to do anything with the request before sending.

    Normally with any of the HTTP methods you create the request then when you are ready to send it you call org.vertx.scala.core.http.HttpClientRequest.end() on it. With this method the request is immediately sent.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  29. def getPort: Int

    returns

    The port

  30. def getReceiveBufferSize: Int

    returns

    The receive buffer size

    Definition Classes
    NetworkSupport
  31. def getSendBufferSize: Int

    returns

    The send buffer size

    Definition Classes
    NetworkSupport
  32. def getSoLinger: Int

    returns

    the value of TCP so linger

    Definition Classes
    TCPSupport
  33. def getTrafficClass: Int

    returns

    the value of traffic class

    Definition Classes
    NetworkSupport
  34. def getTrustStorePassword: String

    returns

    Get trust store password

    Definition Classes
    SSLSupport
  35. def getTrustStorePath: String

    returns

    Get the trust store path

    Definition Classes
    SSLSupport
  36. def getTryUseCompression: Boolean

    Returns true if the org.vertx.scala.core.http.HttpClient should try to use compression.

  37. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  38. def head(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP HEAD request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP HEAD request with the specified uri.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  39. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  40. def isKeepAlive: Boolean

    returns

    Is the client keep alive?

  41. def isReuseAddress: Boolean

    returns

    The value of reuse address

    Definition Classes
    NetworkSupport
  42. def isSSL: Boolean

    returns

    Is SSL enabled?

    Definition Classes
    SSLSupport
  43. def isTCPKeepAlive: Boolean

    returns

    true if TCP keep alive is enabled

    Definition Classes
    TCPSupport
  44. def isTCPNoDelay: Boolean

    returns

    true if Nagle's algorithm is disabled.

    Definition Classes
    TCPSupport
  45. def isTrustAll: Boolean

    returns

    true if this client will trust all server certificates.

    Definition Classes
    ClientSSLSupport
  46. def isUsePooledBuffers: Boolean

    returns

    true if pooled buffers are used

    Definition Classes
    TCPSupport
  47. def isVerifyHost: Boolean

    returns

    true if this client will validate the remote server's certificate hostname against the requested host

  48. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  49. final def notify(): Unit

    Definition Classes
    AnyRef
  50. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  51. def options(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP OPTIONS request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP OPTIONS request with the specified uri.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  52. def patch(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP PATCH request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP PATCH request with the specified uri.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  53. def post(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP POST request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP POST request with the specified uri.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  54. def put(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP PUT request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP PUT request with the specified uri.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  55. def request(method: String, uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP request with the specified uri. The specific HTTP method (e.g. GET, POST, PUT etc) is specified using the parameter method

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  56. def setConnectTimeout(timeout: Int): HttpClient

    Set the connect timeout in milliseconds.

    Set the connect timeout in milliseconds.

    returns

    a reference to this so multiple method calls can be chained together

  57. def setHost(host: String): HttpClient

    Set the host that the client will attempt to connect to the server on to host.

    Set the host that the client will attempt to connect to the server on to host. The default value is localhost

    returns

    A reference to this, so multiple invocations can be chained together.

  58. def setKeepAlive(keepAlive: Boolean): HttpClient

    If keepAlive is true then, after the request has ended the connection will be returned to the pool where it can be used by another request.

    If keepAlive is true then, after the request has ended the connection will be returned to the pool where it can be used by another request. In this manner, many HTTP requests can be pipe-lined over an HTTP connection. Keep alive connections will not be closed until the org.vertx.scala.core.http.HttpClient.close() method is invoked.

    If keepAlive is false then a new connection will be created for each request and it won't ever go in the pool, the connection will closed after the response has been received. Even with no keep alive, the client will not allow more than org.vertx.scala.core.http.HttpClient.getMaxPoolSize() connections to be created at any one time.

    returns

    A reference to this, so multiple invocations can be chained together.

  59. def setKeyStorePassword(pwd: String): HttpClient.this.type

    Set the password for the SSL key store.

    Set the password for the SSL key store. This method should only be used in SSL mode, i.e. after org.vertx.scala.core.SSLSupport.setSSL(boolean) has been set to true.

    returns

    A reference to this, so multiple invocations can be chained together.

    Definition Classes
    SSLSupport
  60. def setKeyStorePath(path: String): HttpClient.this.type

    Set the path to the SSL key store.

    Set the path to the SSL key store. This method should only be used in SSL mode, i.e. after org.vertx.scala.core.SSLSupport.setSSL(boolean) has been set to true.

    The SSL key store is a standard Java Key Store, and will contain the client certificate. Client certificates are only required if the server requests client authentication.

    returns

    A reference to this, so multiple invocations can be chained together.

    Definition Classes
    SSLSupport
  61. def setMaxPoolSize(maxConnections: Int): HttpClient

    Set the maximum pool size

    Set the maximum pool size

    The client will maintain up to maxConnections HTTP connections in an internal pool

    returns

    A reference to this, so multiple invocations can be chained together.

  62. def setMaxWebSocketFrameSize(maxSize: Int): HttpClient

    Sets the maximum websocket frame size in bytes.

    Sets the maximum websocket frame size in bytes. Default is 65536 bytes.

    maxSize

    The size in bytes

  63. def setPort(port: Int): HttpClient

    Set the port that the client will attempt to connect to the server on to port.

    Set the port that the client will attempt to connect to the server on to port. The default value is 80

    returns

    A reference to this, so multiple invocations can be chained together.

  64. def setReceiveBufferSize(size: Int): HttpClient.this.type

    Set the receive buffer size for connections created by this instance to size in bytes.

    Set the receive buffer size for connections created by this instance to size in bytes.

    returns

    a reference to this so multiple method calls can be chained together

    Definition Classes
    NetworkSupport
  65. def setReuseAddress(reuse: Boolean): HttpClient.this.type

    Set the reuseAddress setting for connections created by this instance to reuse.

    Set the reuseAddress setting for connections created by this instance to reuse.

    returns

    a reference to this so multiple method calls can be chained together

    Definition Classes
    NetworkSupport
  66. def setSSL(ssl: Boolean): HttpClient.this.type

    If ssl is true, this signifies that any connections will be SSL connections.

    If ssl is true, this signifies that any connections will be SSL connections.

    returns

    A reference to this, so multiple invocations can be chained together.

    Definition Classes
    SSLSupport
  67. def setSendBufferSize(size: Int): HttpClient.this.type

    Set the send buffer size for connections created by this instance to size in bytes.

    Set the send buffer size for connections created by this instance to size in bytes.

    returns

    a reference to this so multiple method calls can be chained together

    Definition Classes
    NetworkSupport
  68. def setSoLinger(linger: Int): HttpClient.this.type

    Set the TCP soLinger setting for connections created by this instance to linger.

    Set the TCP soLinger setting for connections created by this instance to linger. Using a negative value will disable soLinger.

    returns

    a reference to this so multiple method calls can be chained together

    Definition Classes
    TCPSupport
  69. def setTCPKeepAlive(keepAlive: Boolean): HttpClient.this.type

    Set the TCP keepAlive setting for connections created by this instance to keepAlive.

    Set the TCP keepAlive setting for connections created by this instance to keepAlive.

    returns

    a reference to this so multiple method calls can be chained together

    Definition Classes
    TCPSupport
  70. def setTCPNoDelay(tcpNoDelay: Boolean): HttpClient.this.type

    If tcpNoDelay is set to true then Nagle's algorithm will turned off for the TCP connections created by this instance.

    If tcpNoDelay is set to true then Nagle's algorithm will turned off for the TCP connections created by this instance.

    returns

    a reference to this so multiple method calls can be chained together

    Definition Classes
    TCPSupport
  71. def setTrafficClass(trafficClass: Int): HttpClient.this.type

    Set the trafficClass setting for connections created by this instance to trafficClass.

    Set the trafficClass setting for connections created by this instance to trafficClass.

    returns

    a reference to this so multiple method calls can be chained together

    Definition Classes
    NetworkSupport
  72. def setTrustAll(trustAll: Boolean): HttpClient.this.type

    If you want an SSL client to trust *all* server certificates rather than match them against those in its trust store, you can set this to true.

    If you want an SSL client to trust *all* server certificates rather than match them against those in its trust store, you can set this to true.

    Use this with caution as you may be exposed to "main in the middle" attacks

    trustAll

    Set to true if you want to trust all server certificates

    Definition Classes
    ClientSSLSupport
  73. def setTrustStorePassword(pwd: String): HttpClient.this.type

    Set the password for the SSL trust store.

    Set the password for the SSL trust store. This method should only be used in SSL mode, i.e. after org.vertx.scala.core.SSLSupport.setSSL(boolean) has been set to true.

    returns

    A reference to this, so multiple invocations can be chained together.

    Definition Classes
    SSLSupport
  74. def setTrustStorePath(path: String): HttpClient.this.type

    Set the path to the SSL trust store.

    Set the path to the SSL trust store. This method should only be used in SSL mode, i.e. after org.vertx.scala.core.SSLSupport.setSSL(boolean) has been set to true.

    The trust store is a standard Java Key Store, and should contain the certificates of any servers that the client trusts.

    returns

    A reference to this, so multiple invocations can be chained together.

    Definition Classes
    SSLSupport
  75. def setTryUseCompression(tryUseCompression: Boolean): HttpClient

    Set if the org.vertx.scala.core.http.HttpClient should try to use compression.

  76. def setUsePooledBuffers(pooledBuffers: Boolean): HttpClient.this.type

    Set if vertx should use pooled buffers for performance reasons.

    Set if vertx should use pooled buffers for performance reasons. Doing so will give the best throughput but may need a bit higher memory footprint.

    returns

    a reference to this so multiple method calls can be chained together

    Definition Classes
    TCPSupport
  77. def setVerifyHost(verifyHost: Boolean): HttpClient

    If verifyHost is true, then the client will try to validate the remote server's certificate hostname against the requested host.

    If verifyHost is true, then the client will try to validate the remote server's certificate hostname against the requested host. Should default to 'true'. This method should only be used in SSL mode, i.e. after org.vertx.scala.core.http.HttpClient.setSSL(boolean) has been set to true.

    returns

    A reference to this, so multiple invocations can be chained together.

  78. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  79. def toString(): String

    Definition Classes
    AnyRef → Any
  80. def trace(uri: String, responseHandler: (HttpClientResponse) ⇒ Unit): HttpClientRequest

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP TRACE request with the specified uri.

    This method returns an org.vertx.scala.core.http.HttpClientRequest instance which represents an HTTP TRACE request with the specified uri.

    When an HTTP response is received from the server the responseHandler is called passing in the response.

  81. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  82. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  83. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  84. def wrap[X](doStuff: ⇒ X): HttpClient.this.type

    Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types

    Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types

    Attributes
    protected[this]
    Definition Classes
    Self

Inherited from ClientSSLSupport

Inherited from SSLSupport

Inherited from TCPSupport

Inherited from NetworkSupport

Inherited from AsJava

Inherited from Self

Inherited from AnyRef

Inherited from Any

Ungrouped