Lightweight RESTful Java Framework

I am browsing RESTful web services in Java, and most of the approaches I have found look pretty bloated. These include approaches from NetBeans, Spring 3, and EJB using singletones.

Maybe I'm wrong, so please feel free to correct me, but they all β€œfeel” as very complex solutions to a relatively simple problem.

Can anyone suggest a simple and easy approach to RESTful web services in java?

I'm not sure if MVC is needed at the back end for them, instead I look at clean vertical slices.

I don't need persistence if it can't be connected to mongoDB - so I don't need ORM mapping.

+7
source share
6 answers

Take a look at Dropwizard , the resumes on the website said what you need to say.

Developed by Yammer to support its internal JVM-based services, Dropwizard integrates stable , mature libraries from the Java ecosystem into a simple , lightweight package that lets you focus on something done.

Dropwizard has built-in support for complex configuration , application metrics, logging, operational tools and much more, allowing you and your team to deliver HTTP + JSON web content with service quality production in no time.

I used it for a simple application recently, and it turned out to be very fast and easy to get started and use it until the application is complete.

+7
source

To add another option to the mix, Spark :

Sinatra-based micro-web infrastructure

For Java.

I haven't used it personally, but it looks promising, and I'm definitely going to check it out.

And no, I have nothing to do with Spark.

+9
source

I used CXF and Jersey for JAX-RS to create RESTful web services. It was very simple to create / deploy a RESTful service using any of them. I believe the documentation was sufficient to run.

+8
source

You can check out http://www.restlet.org/ . Another option is to write a simple servlet to handle requests, especially if it is a small project.

+3
source

I would suggest using Apache Httpcomponents . Thanks to this, you can easily use the Restful web service.

There is an example of a non-blocking, asynchronous HTTP server or an old style blocking one .

Another advantage is that you do not need application servers for this, so you can just run the application and there you go. If you don't need the power of a Servlet container or Java EE, this seems to be a good way.

+1
source

For data-based RESTful services, you're probably right about your assumption of MVC ... you want some kind of JSON to return from the urls.

For true RESTful services (based on Hypermedia) with mediatype format formats. MVC plays very nicely, as presentations become your media format. This is especially true if you use HTML / XML as a basic media format.

+1
source

All Articles