Module io.inverno.mod.http.server


module io.inverno.mod.http.server

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

It defines the following sockets:

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...)
configuration
the HTTP server module configuration
controller
override the default HTTP server controller used to process server exchanges
headerCodecs
custom header codecs
parameterConverter
override the default parameter converter used in Parameter instances to convert their values

It exposes the following beans:

configuration
the HTTP server module configuration
controller
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)))
     .setController(ServerController.from(
         exchange -> exchange
             .response()
             .body()
             .raw()
             .value(Unpooled.unreleasableBuffer(Unpooled.copiedBuffer("Hello, world!", Charsets.DEFAULT)))
      ))
 ).run();
 
Since:
1.0
Author:
Jeremy Kuhn