Module io.inverno.mod.http.client


module io.inverno.mod.http.client

The Inverno framework HTTP client module provides a HTTP1.x and HTTP/2 client.

It defines the following sockets:

httpClientConfiguration
the HTTP client module configuration
netService (required)
the Net service used to create the HTTP client
reactor (required)
the reactor used in the connection pool
headerCodecs
custom header codecs
parameterConverter
override the default parameter converter used in Parameter instances to convert their values

It exposes the following beans:

httpClientConfiguration
the HTTP client module configuration
httpClient
the HTTP client

A simple HTTP client using the default configuration can be started as follows:


 NetService netService = ...;
 Reactor reactor = ...;
 
 Client client = Application.with(new Client.Builder(netService, reactor)).run();
 
 Endpoint endpoint = client.httpClient().endpoint("example.com". 80).build();
 
 String response = endpoint.request(Method.GET, "/")
	.send()
	.flatMapMany(exchange -> exchange.response().body().string().stream())
	.reduceWith(() -> new StringBuilder(), (acc, chunk) -> acc.append(chunk))
	.map(StringBuilder::toString).block();
 
Since:
1.6
Author:
Jeremy Kuhn