Interface HttpClient
- All Known Subinterfaces:
HttpClientAgent, HttpClientConnection
-
Method Summary
Modifier and TypeMethodDescriptionclose()Close immediately (shutdown(0, TimeUnit.SECONDS).default Future<HttpClientRequest> request()Create an HTTP request to send to the server with the default host and port of the client.default Future<HttpClientRequest> request(HttpMethod method, int port, String host, String requestURI) Create an HTTP request to send to the server at thehostandport.default Future<HttpClientRequest> request(HttpMethod method, String requestURI) Create an HTTP request to send to the server at the default host and port.default Future<HttpClientRequest> request(HttpMethod method, String host, String requestURI) Create an HTTP request to send to the server at thehostand default port.request(RequestOptions options) Create an HTTP request to send to the server.shutdown()Shutdown with a 30 seconds timeout (shutdown(30, TimeUnit.SECONDS)).Callsshutdown(Duration).Initiate the client shutdown sequence.
-
Method Details
-
request
Create an HTTP request to send to the server with the default host and port of the client.- Returns:
- a future notified when the request is ready to be sent
-
request
Create an HTTP request to send to the server.- Parameters:
options- the request options- Returns:
- a future notified when the request is ready to be sent
-
request
default Future<HttpClientRequest> request(HttpMethod method, int port, String host, String requestURI) Create an HTTP request to send to the server at thehostandport.- Parameters:
method- the HTTP methodport- the porthost- the hostrequestURI- the relative URI- Returns:
- a future notified when the request is ready to be sent
-
request
Create an HTTP request to send to the server at thehostand default port.- Parameters:
method- the HTTP methodhost- the hostrequestURI- the relative URI- Returns:
- a future notified when the request is ready to be sent
-
request
Create an HTTP request to send to the server at the default host and port.- Parameters:
method- the HTTP methodrequestURI- the relative URI- Returns:
- a future notified when the request is ready to be sent
-
shutdown
-
close
-
shutdown
Callsshutdown(Duration). -
shutdown
Initiate the client shutdown sequence.Connections are taken out of service and closed when all inflight requests are processed, client connection are immediately removed from the pool. When all connections are closed the client is closed. When the
timeoutexpires, all unclosed connections are immediately closed.- HTTP/2 connections will send a go away frame immediately to signal the other side the connection will close
- HTTP/1.x client connection will be closed after the current response is received
- Parameters:
timeout- the amount of time after which all resources are forcibly closed- Returns:
- a future notified when the client is closed
-