Module io.inverno.mod.web.base


module io.inverno.mod.web.base

The Inverno framework Web base module defines API and provides common services to implement Web enabled HTTP1.x and HTTP/2 clients and servers.

It defines the following sockets:

mediaTypeConverters (required)
The list of media type converters used to encode and decode content based on their media type.

It exposes the following beans:

dataConversionService
The data conversion service used to encode and decode content based on a media type or a WebSocket subprotocol.

 List<MediaTypeConverter<ByteBuf>> converters = ...;

 Base base = new Base.Builder(converters).build();
 try {
     base.start();

     OutboundData<ByteBuf> messageOutbound = ...;
     OutboundDataEncoder<Message> messageEncoder = base.dataConversionService().createEncoder(messageOutbound, MediaTypes.APPLICATION_JSON, Message.class);
     messageEncoder.many(Flux.just(new Message("Hello John"), new Message("Hello Bob"), new Message("Hello Alice")));

     InboundData<ByteBuf> messageInbound = ...;
     InboundDataDecoder<Message> messageDecoder = base.dataConversionService().createDecoder(messageInbound, MediaTypes.APPLICATION_JSON, Message.class);
     Flux<Message> decodedInbound = messageDecoder.many();
 }
 finally {
     base.stop();
 }
 
Since:
1.12
Author:
Jeremy Kuhn