Java REST实现:Jersey vs CXF [英] Java REST implementation: Jersey vs CXF

查看:305
本文介绍了Java REST实现:Jersey vs CXF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您认为这两个图书馆之间的优缺点是什么?这两个中哪一个最适合生产环境?顺便说一句,我将使用JSON而不是XML。

What do you think is the advantages/disadvantages between this two libraries? Which of these two are best suited for production environment? By the way I will be using JSON instead of XML.

我也想知道社区最支持哪个库,例如教程,文档。

I also would like to know what library is most supported by the community e.g. tutorials, documentation.

推荐答案

我已经使用了两者,但出于不同的目的。 CXF非常适合解析WSDL并创建Java POJO以进行交互,因此CXF非常适合客户端WSDL服务。我目前正在使用Jersey进行服务器端实现,我对使用Jersey启动和运行RESTful服务的简单性印象深刻。

I have used both, but for different purposes. CXF worked great to parse a WSDL and create Java POJOs to interact with, so CXF is pretty good for client-side WSDL services. I'm currently using Jersey for server-side implementation and I am impressed with the simplicity of getting up-and-running with RESTful services using Jersey.

由于Jersey主要致力于RESTful服务,而CXF主要(全部?)使用SOAP,我认为这取决于您是否想要使用SOAP或REST,从那里确定工作的最佳框架。就个人而言,我在REST阵营中比SOAP更多,但我的需求是不同的。我是否应该处于这样一种情况:我编写服务的供应商/客户/公司需要某种合同,我可能仍然会推动REST(和REST相当于基于合同的服务, WADL ),但很可能需要实现SOAP服务,在这种情况下,我会先查看CXF,然后再查看其他所有内容。

As Jersey is mainly devoted to RESTful services and CXF deals mostly (all?) with SOAP, I think it comes down to whether you want to work with SOAP or REST, and determine the best framework for the job from there. Personally, I am more in the REST camp than SOAP, but my needs are different. Should I be in a situation where the vendor/customer/company I write the service for needs some sort of contract, I might still push for REST (and REST's equivalent for contract-based services, WADL), but would likely be required to implement a SOAP service, in which case I would look at CXF first and everything else second.

就个人而言,泽西岛对JAX-RS框架非常有用,但不排除 RESTEasy ,由JBoss提供。我喜欢这两个,但RESTEasy的文档更好。

Personally, Jersey is pretty good for a JAX-RS framework, although don't exclude RESTEasy, by JBoss. I like both, but the documentation for RESTEasy is better.

对于CXF,文档没问题,但我遇到了处理SSL和HTTP代理的不一致问题,但它最终成功了。 CXF确实提供了关于这些附加功能的更多开箱即用,我想说RESTEasy将为RESTful框架提供相同的功能。

For CXF, the documentation is OK, but I ran into inconsistencies in how I needed to handle SSL and HTTP Proxies, but it worked itself out eventually. CXF does provide more out of the box regarding these additional features, and I would say RESTEasy would provide the equivalent functionality for RESTful frameworks.

这篇关于Java REST实现:Jersey vs CXF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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