OpenJAX ESC (Embedded Servlet Container) is a conveneince wrapper of the Jetty Servlet Container, which provides helpful patterns to developers that desire a lightweight embedded server solution.
OpenJAX ESC (Embedded Servlet Container) is created to take full advantage of the javax.servlet.annotation.*
annotations defined in the Java Servlet v3 Specification of 2009. Designed specifically to avoid non-cohesive config files, OpenJAX ESC (Embedded Servlet Container) creates a direct and easy to understand embedded wrapper of the Jetty Servlet Container. OpenJAX ESC (Embedded Servlet Container) provides a simple API to initialize a Servlet Container in a JVM, significantly reducing the headache most people have when attempting to accomplish the same with Jetty's raw APIs.
OpenJAX ESC (Embedded Servlet Container) is intended to reduce the number of lines of code dedicated to the initialization of the server, therefore reducing the space of possible errors, and thus allowing the developer to move to his next task, confidently assured the server will start.
-
Next, add the
org.openjax:embedded-server
dependency to the POM.<dependency> <groupId>org.openjax.esc</groupId> <artifactId>jetty-9</artifactId> <version>1.0.0</version> </dependency>
-
Make
App
extendorg.openjax.embeddedserver.EmbeddedJetty9
, and add a constructor.public class Server extends EmbeddedJetty9 { public Server(int port) { super(port); } }
-
Add the server initialization code in
Server#main()
.public static void main(String[] args) { Server server = new Server(8080); server.start(); server.join(); }
-
Run
App
.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
This project is licensed under the MIT License - see the LICENSE.txt file for details.