users@jersey.java.net

[Jersey] Re: Advantage of Servlets?

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Mon, 7 Apr 2014 18:27:23 +0200

On 02 Apr 2014, at 23:21, Robert DiFalco <robert.difalco_at_gmail.com> wrote:

> I have a very simple REST server. Simple in that it is stateless and delegates almost all of its work to JOB servers that run in other processes. This allows me to spin up any number of REST servers.
>
> So given this sort of setup? What advantage do I get from Servlets? Is there any reason I shouldn't just configure this for Grizzly HTTP?

Perhaps basic declarative security support. If you run in Java EE container, you can leverage other Java EE features too.

>
> Is performance or load any different between the two? Right now it runs fine with Grizzly HTTP but I didn't know if I am losing anything by not having servlets. Seems like all the filtering I want to do I can just do with JAX-RS filters -- I don't need servlet style context filters.

Servlet is API. Grizzly is concrete framework (which btw. supports Servlet API via extension module). You cannot compare "fruits" to oranges...

>
> I'm just making sure I didn't make a naive choice. It feels nice having a simple HTTP server without the servlet framework.

For your use case you may be fine with plain Grizzly HTTP server. You do not seem to need additional layers of APIs since you do not seem to be using the extra EE features.

Marek

>
> R.