Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring RestTemplate Vs Jersey Rest Client Vs RestEasy Client

Which one of these implementation is recommended for asynchronous rest API calls from client applications and also more robust?

  1. Sprint resttemplate
  2. Jersey rest client
  3. Rest easy client
like image 506
Deepthi Avatar asked Sep 01 '15 17:09

Deepthi


1 Answers

Here are Some links to documentations and examples in order to help you evaluate what each client has to offer from in descending order of my personal recommendation from the best to the common and some links to other comparisons that I have found.

  1. RESTEasy is a JBoss project is my first selection since it has Caching Features: Client "Browser" cache. Supports HTTP 1.1 caching semantics including cache revalidation that has huge impact on performance while other client implementations do not provide caching out of the box and you need to write extra code to get it. RESTEasy provides various frameworks to help you build RESTful Web Services and RESTful Java applications. It is a fully certified and portable implementation of the JAX-RS 2.0 specification, a JCP specification that provides a Java API for RESTful Web Services over the HTTP protocol.

RESTEasy Features List

  • Portable to Tomcat and many other app-server
  • Embeddedable server implementation for JUnit testing
  • Enhanced client framework
  • Caching Features: Client "Browser" cache. Supports HTTP 1.1 caching semantics including cache revalidation
  • Server in-memory cache. Local response cache. Automatically handles ETag generation and cache revalidation
  • Rich set of providers for: XML, JSON, YAML, Fastinfoset, Multipart, XOP, Atom, etc.
  • JAXB marshalling into XML, JSON, Jackson, Fastinfoset, and Atom as well as wrappers for maps, arrays, lists, and sets of JAXB Objects.
  • GZIP content-encoding
  • Asynchronous HTTP (Comet) abstractions for JBoss Web, Tomcat 6, and Servlet 3.0
  • Asynchronous Job Service.
  • Rich interceptor model.
  • OAuth2 and Distributed SSO with JBoss AS7
  • Digital Signature and encryption support with S/MIME and DOSETA
  • EJB, Seam, Guice, Spring, and Spring MVC integration
  • There was no RESTEasy Spring Boot starter out there, so PayPal team decided to create RESTEasy Spring Boot Starter and share it with the community.

RESTEasy examples see also Three Forms of RESTEasy Client

  1. Jersey RESTful Web Services framework is open source, production quality, framework for developing RESTful Web Services in Java that provides support for JAX-RS APIs and serves as a JAX-RS (JSR 311 & JSR 339) Reference Implementation.

Jersey framework is more than the JAX-RS Reference Implementation. Jersey provides it’s own API that extend the JAX-RS toolkit with additional features and utilities to further simplify RESTful service and client development. Jersey also exposes numerous extension SPIs so that developers may extend Jersey to best suit their needs.

Goals of Jersey project can be summarized in the following points:

  • Track the JAX-RS API and provide regular releases of production quality Reference Implementations that ships with GlassFish;
  • Provide APIs to extend Jersey & Build a community of users and developers; and - Make it easy to build RESTful Web services utilising Java and the Java Virtual Machine.

There are several Jersey Connectors to choose from see Chapter 5. Client API 5.5. Client Transport Connectors while Grizzly looks like the most advanced especially since it is using the NIO framework to help developers to take advantage of the Java™ NIO API see java.net versus java.nio it was used with AsyncHttpClient progect that might have all you need.

By default, the transport layer in Jersey is provided by HttpUrlConnection. This transport is implemented in Jersey via HttpUrlConnectorProvider that implements Jersey-specific Connector SPI. You can implement and/or register your own Connector instance to the Jersey Client implementation, that will replace the default HttpUrlConnection-based transport layer. Jersey provides several alternative client transport connector implementations that are ready-to-use.

Table 5.1. List of Jersey Connectors Transport framework Jersey Connector implementation Maven dependency

  • Grizzly NIO framework GrizzlyConnectorProvider org.glassfish.jersey.connectors:jersey-grizzly-connector
  • Apache HTTP client ApacheConnectorProvider org.glassfish.jersey.connectors:jersey-apache-connector
  • Jetty HTTP client JettyConnectorProvider org.glassfish.jersey.connectors:jersey-jetty-connector
  • Netty NIO framework NettyConnectorProvider org.glassfish.jersey.connectors:jersey-netty-connector

Jersey vs. RESTEasy: A JAX-RS Implementation Comparison

  1. Spring RestTemplate or for asynchronous rest API calls AsyncRestTemplate see Spring 4 AsyncRestTemplate + ListenableFuture Example is the default Spring Boot starter Restful api. There was no RESTEasy Spring Boot starter out there until PayPal team decided to create RESTEasy Spring Boot Starter and share it with the community.
like image 196
Tomer Bar-Shlomo Avatar answered Nov 07 '22 17:11

Tomer Bar-Shlomo