One possible architectural and deployment model choice is to use an embedded web server for enabling HTTP interface for an application. 10Duke SDK implements Jetty6BasedWebServer class that uses Jetty as embedded web server. 10Duke SDK also includes interfaces and mechanisms that make integrating any embedded web server easier.
If an embedded web server is used, its lifecycle must be managed by the application. Solution for this is to use a service that is responsible for initializing and closing the embedded web server. HttpServerService is a service that does exactly this. By default, it initializes and manages Jetty6BasedWebServer, but it can be configured to manage any web server implementation that implements WebServer interface.
If own embedded web server needs to be implemented and used instead of the provided Jetty6BasedWebServer, options to achieve this include:
Develop own embedded web server class that implements WebServer interface, and configure HttpServerService to manage it
Develop own service class that manages manages lifecycle of any kind of own embedded web server
In order to enable the embedded Jetty6BasedWebServer, it is sufficient to configure HttpServerService to use. This configuration is done by adding lifecycle.servicemanager.service.classname.* configuration parameter where * must be substituted with a positive integer defining order of services to load. Example configuration entry that defines HttpServerService as the first service to load is given below:
<entry key="lifecycle.servicemanager.service.classname.1">com.tenduke.services.http.HttpServerService</entry>
HttpServerService uses Jetty6BasedWebServer as default embedded web server. If another embedded web server class implementing WebServer interface needs to managed by HttpServerService, it can be configured by using networking.httpserver.classname configuration parameter by giving fully qualified class name of the other web server. For instance:
<entry key="networking.httpserver.classname">com.example.MyOwnWebServer</entry>