What RESTHeart is Not


What RESTHeart is Not

19 November 2015  • SoftInstigate Team
Categories: en, technology  • Tags: restheart

We are asked once in a while how RESTHeart can be embedded in a traditional JEE Application Server. However RESTHeart is designed to operate in microservice architectures as a stand alone process. It does one thing and it does it well.

I am considering RESTHeart for a new project. The project require to use JSP pages and Servlets along with static html pages. Does RESTHeart support JSP and Servlets? I don’t want to run another server for deploying JSPs. Another option I am thinking of is Wildfly; how can I use RESTHeart with Wildfly? Again I don’t want to run two separate servers; one for JSP/Servelts and another for RESTHeart. Hope that make sense.

We understand your requirements, but RESTHeart is neither a servlet container nor an application server like Wildfly.

It’s actually a REST API server, so it fits an architecture where you need to invoke data services on top of MongoDB via HTTP but don’t want to waste time building the CRUD logic by yourself.

RESTheart embeds Undertow, exactly like Wildfly does, but in our case we use only the HTTP layer and we don’t include the Undertow’s servlet container: that’s by design.

RESTHeart was made with the idea that you run specialized, independently deployable micro-services, which goes in the opposite direction from the model of a monolithic application server where one puts everything in.

RESTHeart suits much better in a scenario where you are creating single page applications with tools like AngularJs or React, accessing RESTful services via AJAX calls.

You can of course serve also HTML or other static assets like images and documents from RESTHeart, but no dynamic content like JSP.

In theory it is totally possibile to embed a template library like Velocity or Freemarker and then create the appropriate application handlers for it, but we haven’t tried it yet: see the official documentation section for Application Logic.

It’s not documented yet, but for embedding extra libraries we suggest to have a look at the Maven Shade plugin.