There’s no law which states web servers and servlet containers must be large, separate pieces of software. If there were, Jetty would be a dangerous outlaw (possibly even public enemy number one). Jetty is an open-source embeddable web server and servlet container, written in Java. It’s small, fast, and easy to embed – perfect for self-contained applications.
Let’s use an example to discover just how easy embedding Jetty can be. Say we have two servlets, one should be mapped to
/service/one and the other
/service/two, served on port
That’s it; easy. For information and more examples on embedding Jetty in your Java application, read Embedding Jetty.