This modules provides a minimal service provider interface (SPI) using ServiceLoader
to launch an instance of embedded Jetty with potentially a number of Jersey JAX-RS applications and generic Jetty context handlers.
You can provide as many as implementations of the following interfaces in the class path to be loaded via Java ServiceLoader
:
LoggingConfigurator
to be loaded in the initialstatic
context to be able to apply any logging configuration early when JVM starts.ApplicationFactory
to create an instance Jersey JAX-RS application.ContextHandlerFactory
to create an instance ofContextHandler
for Jetty.RequestLogHandlerFactory
to create an instanceRequestLogHandler
for Jetty (e.g. to configure access logs in Jetty).
By default, the following implementations are activated provided with the conditions:
- A context handler to serve at
/docs
if the environment values either contain existing${application.name}.root/docs
or${application.name}.docs.root
.
The module provides a standard Java main class that can be used as:
$ java OPTIONS com.fredhopper.server.Bootstrap
or alternatively, if embedded-rest-server.jar
is used:
$ java -jar embedded-rest-server.jar
or alternatively, use EmbeddedServer
API in your code.
Note that the Maven dependencies such as e.g. Jetty and Jersey, must be explicitly be declared
in your POM files. This module only exposes them in provided
scope to allow downstream dependencies
to use their own versions.
Please refer to here.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.