Module io.inverno.mod.web.client
module io.inverno.mod.web.client
The Inverno framework Web client module provides a Web enabled HTTP1.x and HTTP/2 client.
It combines Inverno HTTP discovery module and HTTP client module behind an API that abstract service resolution and service request logic. The Web client API also extends the HTTP client API with global interceptor definitions and automatic content encoding and decoding.
It defines the following sockets:
- discoveryServices (required)
- The list of HTTP discovery services used to resolve service URIs.
- httpClient (required)
- The HTTP client used to create unbound exchanges.
- mediaTypeConverters (required)
- The media type converters used to encode and decode payloads.
- reactor (required)
- The reactor providing the event loop used to refresh cached services.
- configuration
- The Web client module configuration.
- parameterConverter
- A parameter converter used to convert parameter values.
It exposes the following beans:
- configuration
- The Web client module configuration
- webClientBoot
- The Web client boot used to initialize the root Web client
A Web client can be creates and used as follows:
List<? extends HttpDiscoveryService> discoveryServices = ... // dnsHttpDiscoveryService, configurationHttpMetaDiscoveryService...
HttpClient httpClient = ...
List<MediaTypeConverter<ByteBuf>> mediaTypeConverters = ...
Reactor reactor = ...
Client module = new Client.Builder(discoveryServices, httpClient, mediaTypeConverters, reactor).build();
try {
WebClient<AppContext> rootWebClient = module.webClientBoot().webClient(AppContext::new);
String responseBody = rootWebClient
.exchange(URI.create("http://example.org"))
.flatMap(WebExchange::response)
.flatMapMany(response -> response.body().string().stream())
.collect(Collectors.joining())
.block();
}
finally {
module.stop();
}
- Since:
- 1.12
- Author:
- Jeremy Kuhn
-
Packages
PackageDescriptionInverno Web client API and module configuration.Inverno Web client annotations.Inverno Web client WebSocket API.FromPackagesio.inverno.mod.base io.inverno.mod.base.concurrent io.inverno.mod.base.converter io.inverno.mod.base.net io.inverno.mod.base.reflect io.inverno.mod.base.resource -
Modules
ModifierModuleDescriptiontransitiveDefines the foundational APIs of the Inverno framework modules.transitiveThe Inverno framework discovery module defines the API used for service discovery.transitiveThe Inverno framework HTTP service discovery module defines the API for HTTP service discovery and provides the DNS based HTTP discovery service.transitiveThe Inverno framework HTTP client module provides an HTTP1.x and HTTP/2 client.transitiveThe Inverno framework Web base module defines API and provides common services to implement Web enabled HTTP1.x and HTTP/2 clients and servers.ModifierModuleDescriptiontransitiveThe Inverno framework HTTP base module defines base APIs and services for HTTP client and server implementations.