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:

httpServerConfiguration
the HTTP server module configuration
netService (required)
the Net service used to create the HTTP server
resourceService (required)
the resource service used to load resources required by the HTTP server (eg. key store...)
rootHandler
override the default HTTP server root handler used to process server exchanges
errorHandler
override the default HTTP server error handler used to process error exchanges
parameterConverter
override the default parameter converter used in Parameter instances to convert their values

It exposes the following beans:

httpServerConfiguration
the HTTP server module configuration
rootHandler
the HTTP server root exchange handler
errorHandler
the HTTP server error exchange handler

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


 NetService netService = ...;
 ResourceService resourceService = ...;

 Application.with(new Server.Builder(netService, resourceService)
     .setHttpServerConfiguration(HttpServerConfigurationLoader.load(conf -> conf.server_port(8080)))
     .setRootHandler(
         exchange -> exchange
             .response()
             .body()
             .raw()
             .value(Unpooled.unreleasableBuffer(Unpooled.copiedBuffer("Hello, world!", Charsets.DEFAULT)))
      )
 ).run();
 
Since:
1.0
Author:
Jeremy Kuhn