Java JAX-RS 框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/80799/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JAX-RS Frameworks
提问by Shimi Bandiel
I've been doing some work with the JAX-RS reference implementation (Jersey). I know of at least two other frameworks (Restlet & Apache CXF).
我一直在使用 JAX-RS 参考实现 (Jersey) 做一些工作。我至少知道另外两个框架(Restlet 和 Apache CXF)。
My question is: Has anyone done some comparison between those frameworks and if so, which framework would you recommend and why?
我的问题是:有没有人对这些框架进行过一些比较,如果是,你会推荐哪个框架,为什么?
采纳答案by James Strachan
FWIW we're using Jersey as its packed full of features (e.g. WADL, implicit views, XML/JSON/Atom support) has a large and vibrant developer community behind it and has great spring integration.
FWIW 我们使用 Jersey 作为它的全部功能(例如 WADL、隐式视图、XML/JSON/Atom 支持),它背后有一个庞大而充满活力的开发人员社区,并且具有很好的spring 集成。
If you use JBoss/SEAM you might find RESTeasy integrates a little better - but if you use Spring for Dependency Injection then Jersey seems the easiest, most popular, active and functional implementation.
如果您使用 JBoss/SEAM,您可能会发现 RESTeasy 集成得更好一些 - 但如果您使用 Spring 进行依赖注入,那么 Jersey 似乎是最简单、最流行、最活跃和功能性的实现。
回答by Peter Hilton
My colleague mentions why we are using RESTeasy for our current project in RESTful web services in Java EE with RESTeasy (JAX-RS):
我的同事提到了为什么我们在 Java EE 和 RESTeasy (JAX-RS)中的RESTful Web 服务中为我们当前的项目使用 RESTeasy :
Its reference implementation, Jersey, was not chosen because we had trouble integrating it well with EJB3 and Seam 2.0.
We are using the RESTeasy implementation of JAX-RS, because we had no trouble integrating it with our EJBs and Seam. It also has sufficient documentation.
There is another implementation from Apache, but I haven't tried it because it uses an older version of JAX-RS.
Finally there is yet another framework for RESTful web services for Java called Restlet but we did not favour it because at the time of this writing, it is using a custom architecture, even though proper JAX-RS support is in the works.
没有选择它的参考实现 Jersey,因为我们无法将它与 EJB3 和 Seam 2.0 很好地集成。
我们正在使用 JAX-RS 的 RESTeasy 实现,因为我们可以轻松地将它与我们的 EJB 和 Seam 集成。它也有足够的文档。
Apache 有另一个实现,但我没有尝试过,因为它使用了旧版本的 JAX-RS。
最后,还有另一个适用于 Java 的 RESTful Web 服务框架,称为 Restlet,但我们并不赞成它,因为在撰写本文时,它使用的是自定义架构,尽管适当的 JAX-RS 支持正在开发中。
回答by Avi Flax
My team and I use Restlet extensively, but not its JAX-RS features. I can tell you that I've been very impressed with the Restlet developers and community; they're very active, engaged, responsive, and committed to a stable, efficient, reliable, and effective framework. I'm sorry I can't directly address your primary interest but I thought you might find my experience with Restlet valuable.
我和我的团队广泛使用 Restlet,但不使用它的 JAX-RS 功能。我可以告诉你,Restlet 的开发者和社区给我留下了深刻的印象。他们非常积极、投入、反应迅速,并致力于建立一个稳定、高效、可靠和有效的框架。很抱歉,我无法直接解决您的主要兴趣,但我认为您可能会发现我在 Restlet 方面的经验很有价值。
回答by StaxMan
It seems like there are 4 decent JAX-RS implementations, so you are probably ok with any of them. For what it's worth, I have found Jersey (1.0.2) really nice so far. My needs are quite modest, simple back-end service, take care of plumbing and so on. And that Jersey does quite nicely.
似乎有 4 个不错的 JAX-RS 实现,因此您可能对其中任何一个都满意。就其价值而言,到目前为止,我发现 Jersey (1.0.2) 非常好。我的需求是相当谦虚,简单的后端服务,照顾管道等等。那个泽西岛做得很好。
回答by Shimi Bandiel
Found out that Apache Wink is very easy to work with, supports JAX-RS and has many features beyond the standard.
发现 Apache Wink 非常易于使用,支持 JAX-RS 并且具有许多超出标准的特性。
回答by Jerome Louvel
Restlethas an extensive list of extensions for Spring, WADL, XML, JSON as well and many more, including an extension for JAX-RS API.
Restlet有大量针对 Spring、WADL、XML、JSON 等的扩展列表,包括 JAX-RS API 的扩展。
It is also the sole framework available in six consistent editions:
- Java SE
- Java EE
- Google Web Toolkit
- Google AppEngine
- Android
- OSGi environments
- Java SE
- Java EE
- 谷歌网络工具包
- 谷歌应用引擎
- 安卓
- OSGi 环境
Its main benefits are:
它的主要好处是:
- fully symmetric client and server API when JAX-RS was designed for server-side processing
- connectors for other protocols than HTTP (mapping to HTTP semantics) when JAX-RS is HTTP only
- much broader feature scope including full URI routing control via the Restlet API (but can integrate with Servlet if needed)
- full provision for NIO support
- 当 JAX-RS 设计用于服务器端处理时,完全对称的客户端和服务器 API
- 当 JAX-RS 仅为 HTTP 时,用于除 HTTP 之外的其他协议的连接器(映射到 HTTP 语义)
- 更广泛的功能范围,包括通过 Restlet API 进行的完整 URI 路由控制(但可以在需要时与 Servlet 集成)
- 为 NIO 提供全面支持
The JAX-RS API can be a good choice if you are restricted to JCP approved APIs (then don't use Spring or any extension of the JAX-RS projects like Jersey and RESTeasy!), but otherwise Restlet is the most mature framework (initially released in 2005) and will give you, in its 2.0 version, all the benefits of annotations combined with a powerful and extensible class-oriented framework.
如果您仅限于 JCP 批准的 API,则 JAX-RS API 可能是一个不错的选择(然后不要使用 Spring 或 JAX-RS 项目的任何扩展,如 Jersey 和 RESTeasy!),但否则 Restlet 是最成熟的框架(最初于 2005 年发布)并将在其 2.0 版本中为您提供注解的所有好处以及强大且可扩展的面向类的框架。
For a longer list of features, please check this page.
如需更长的功能列表,请查看此页面。
Best regards, Jerome Louvel
最好的问候,杰罗姆·卢维尔
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Restlet ~ 创始人和首席开发人员 ~ http://www.restlet.org
回答by Fabián Escalante
I would use no framework. Just the one that comes with your applications server. If you use specifics of one framwork you'll lose portability and you'll be in the hell of what if the vendor of the app server includes a different version of your favourite framework. I'll stick to jax-ws.
我不会使用任何框架。只是您的应用程序服务器附带的那个。如果您使用一个框架的细节,您将失去可移植性,并且如果应用服务器的供应商包含您最喜欢的框架的不同版本,您将陷入困境。我会坚持使用 jax-ws。