Spring RestTemplate vs泽西岛Rest客户端vs RestEasy客户端 [英] Spring RestTemplate Vs Jersey Rest Client Vs RestEasy Client

查看:143
本文介绍了Spring RestTemplate vs泽西岛Rest客户端vs RestEasy客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于从客户端应用程序进行的异步rest API调用,建议采用其中一种实现方式,并且还要更可靠?

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

  1. 冲刺resttemplate
  2. 泽西岛休闲客户
  3. 最轻松的客户

推荐答案

这里有一些文档和示例的链接,以帮助您从我的最佳推荐到最佳推荐的降序评估每个客户所提供的内容.常见和与我发现的其他比较的一些链接.

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是一个JBoss项目,因为它具有,这会对性能产生重大影响,而其他客户端实现则不提供现成的缓存,您需要编写额外的代码来获取它. RESTEasy 提供了各种框架来帮助您构建RESTful Web服务和RESTful Java应用程序.它是JAX-RS 2.0规范的完全认证且可移植的实现,该规范是一种JCP规范,它通过HTTP协议为RESTful Web服务提供Java API.
  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功能列表

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 示例另请参见

RESTEasy examples see also Three Forms of RESTEasy Client

  1. Jersey RESTful Web服务框架是开源的,生产质量的,用于在Java中开发RESTful Web服务的框架提供对JAX-RS API的支持并用作JAX-RS(JSR 311和JSR 339)参考实现.
  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框架不仅仅是JAX-RS参考实现.泽西岛(Jersey)提供了自己的API,该API扩展了JAX-RS工具箱,并具有其他功能和实用程序,以进一步简化RESTful服务和客户端开发.泽西岛还公开了许多扩展SPI,以便开发人员可以扩展泽西岛以最适合他们的需求.

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:

  • 跟踪JAX-RS API并定期发布GlassFish附带的生产质量参考实现;
  • 提供API以扩展Jersey&建立用户和开发者社区;并且-使使用Java和Java虚拟机构建RESTful Web服务变得容易.

有几个Jersey连接器可供选择,请参阅第5章.客户端API 5.5.客户端传输连接器 Grizzly 看起来是最高级的,尤其是因为它使用NIO框架来帮助开发人员采用Java™NIO API的优势,请参见 java.net与java.nio AsyncHttpClient保护

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.

默认情况下,Jersey中的传输层由HttpUrlConnection提供.此传输是通过HttpUrlConnectorProvider在Jersey中实现的,该实现实现了Jersey特定的连接器SPI.您可以实现自己的Connector实例和/或将其注册到Jersey客户端实现,这将替换默认的基于HttpUrlConnection的传输层.泽西岛提供了几种可供使用的备用客户端传输连接器实现.

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.

表5.1.球衣连接器列表 传输框架Jersey连接器实现Maven依赖项

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与RESTEasy:JAX-RS实施比较

  1. Spring RestTemplate 或异步REST API调用 Spring 4 AsyncRestTemplate + ListenableFuture示例是默认的Spring Boot启动器Restful api.在PayPal团队决定创建 RESTEasy Spring Boot Starter 并与社区共享.
  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.

这篇关于Spring RestTemplate vs泽西岛Rest客户端vs RestEasy客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆