Comparing Embed-able Java HTTP/REST Servers

I have a project where I want to create a REST service in Java, but embed the HTTP and REST server in the application itself.  Why embedded?  Because we can't install a servlet container on any of the machines we need to run on.  I don't want to serve web pages, just REST services.  Maybe in the future I would like to support web sockets, but that is just a "nice to have".  This is not a public REST API, so we don't need to worry about firewalls.

There are a lot of embed-able java HTTP/REST servers out there.  The good thing is that REST framework part of it seems like a no brainer; Use the reference implementation, Jersey.  We already have a project using Jersey, so it's an easy choice.

But the embed-able HTTP server is not an easy choice.  Here is a list with some features as of 2014-03-17. Options that support NIO and an async model would be nice.


I wish I could offer a conclusion, but you will probably need to research these to meet your own needs.  As far as popularity I think it boils down to Jetty and Simple.

We chose Jetty.  Here are the steps to get your hello world Jetty/Jersey embedded server up and running:

The hard way:
  1. Embed Jetty
  2. Using Jersey with embedded Jetty HTTP Server.  Search for section 4.5.1.4. Jetty HTTP Server.
The easy way:

Comments

Popular Posts