Module io.inverno.mod.web.server
module io.inverno.mod.web.server
The Inverno framework Web server module provides a Web enabled HTTP1.x and HTTP/2 server
It defines a complete APIs for request routing and the creation of REST APIs using a collection of annotations.
It defines the following sockets:
- configuration
- the web 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.
- mediaTypeConverters (required)
- the media type converters used to encode and decode payloads based on the content type of a request or a response
- webRouterConfigurer
- the configurer used to specify the resources exposed by the server
- errorRouterConfigurer
- the configurer used to specify how errors are processed and returned to a client
- parameterConverter
- override the default parameter converter used in
Parameter
instances to convert their values
It exposes the following beans:
- webConfiguration
- the Web server module configuration
- webRouter
- the router used to route a request to the right handler
- errorHandler
- the router used to route a failed request to the right handler
A Web server can then be started as follows:
NetService netService = ...
Reactor reactor = ...
ResourceService resourceService = ...
List<MediaTypeConverter<ByteBuf>> mediaTypeConverters = ...
Application.with(new Web.Builder(mediaTypeConverters, netService, reactor, resourceService)
.setConfiguration(WebServerConfigurationLoader.load(conf -> conf.web(http_conf -> http_conf.server_port(8080))))
.setWebRouterConfigurer(router -> router
.route()
.path("/path/to/resource1")
.method(Method.GET)
.produces(MediaTypes.APPLICATION_JSON)
.produces(MediaTypes.TEXT_PLAIN)
.handler(exchange -> exchange
.response()
.body()
.encoder()
.value("Resource 1")
)
.route()
.path("/path/to/resource2")
.method(Method.GET)
.produces(MediaTypes.APPLICATION_JSON)
.produces(MediaTypes.TEXT_PLAIN)
.handler(exchange -> exchange
.response()
.body()
.encoder()
.value("Resource 2")
)
)
).run();
- Since:
- 1.0
- Author:
- Jeremy Kuhn
-
Packages
PackageDescriptionInverno Web API and module configuration.Annotations for creating Web controllers.Inverno Web SPI defining common interfaces for implementing HTTP server routers. -
Modules
ModifierModuleDescriptiontransitiveDefines the foundational APIs of the Inverno framework modules.transitiveThe Inverno framework HTTP server module provides a HTTP1.x and HTTP/2 server.ModifierModuleDescriptiontransitiveThe Inverno framework HTTP base module defines the base APIs and services for HTTP client and server implementations.