Module io.inverno.mod.http.server

module io.inverno.mod.http.server

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

It defines the following sockets:

the HTTP server module configuration
netService (required)
the Net service used to create the HTTP server
reactor (required)
the Reactor
resourceService (required)
the resource service used to load resources required by the HTTP server (eg. key store...)
override the default HTTP server controller used to process server exchanges
custom header codecs
override the default parameter converter used in Parameter instances to convert their values

It exposes the following beans:

the HTTP server module configuration
the HTTP server controller

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

 NetService netService = ...
 Reactor reactor = ...
 ResourceService resourceService = ...

 Application.with(new Server.Builder(netService, reactor, resourceService)
     .setConfiguration(HttpServerConfigurationLoader.load(conf -> conf.server_port(8080)))
         exchange -> exchange
             .value(Unpooled.unreleasableBuffer(Unpooled.copiedBuffer("Hello, world!", Charsets.DEFAULT)))

Note that in above example, all requests sent to the server are processed with the same handler, the io.inverno.mod.web.server is better suited to route requests based on gRPC service and method names. It is recommended to rely on a protoc plugin for generating a proper gRPC Web routes configurer from Protocol buffer definitions.

Jeremy Kuhn