jaxrs-api VS jsr311-api VS javax.ws.rs-api VS球衣核心VS jaxrs-ri [英] jaxrs-api VS jsr311-api VS javax.ws.rs-api VS jersey-core VS jaxrs-ri

查看:325
本文介绍了jaxrs-api VS jsr311-api VS javax.ws.rs-api VS球衣核心VS jaxrs-ri的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Google上搜索了很多,但对于上述每一个的确切含义仍然感到困惑.

I have googled around quite a bit still am confused as to what each of the above exactly mean.

这是我对它的理解:

  • jaxrs-api :仅包含api.没有执行.但这与JSR311有什么区别
  • jsr311-api :JSR311是一个规范请求.这意味着它应该是一个文档.为什么然后是罐子?
  • javax.ws.rs-api :它是一种实现吗?
  • jersey-core (/jersey客户端):是JSR311的实现.
  • jaxrs-api : contains only api. No implementation. But how is it different from JSR311
  • jsr311-api : JSR311 it is a specification request. Which means it is supposed to be a document. Why then is it a jar?
  • javax.ws.rs-api: Is it an implementation?
  • jersey-core(/jersey client): Is an implementation of JSR311.

我下载了每个jar并尝试反编译并查看其中的内容,但是我只能在所有jar中找到接口,而不能在实现中找到

I downloaded each jar and tried to decompile and see what is inside it, but I am only able to find interfaces in all of them and not the implementation.

我在Maven Shade插件生成的重复警告的上下文中面临这些问题,并且需要对上述内容有适当的了解,以找出要排除的原因以及原因.

I am facing these questions in the context of duplicate warnings generated by maven shade plugin, and need proper understanding of the above to figure out which ones to exclude and why.

推荐答案

我首先要解决这个问题

"JSR311是一个规范请求.这意味着它应该是一个文档.为什么它是一个罐子?"

"JSR311 it is a specification request. Which means it is supposed to be a document. Why then is it a jar?"

除了最后一个(jersey-core),所有这些jar都是规范" jar. JAX-RS(以及许多其他Java)规范定义了实现者应为其实现指定行为的契约(或接口).

Except the last (jersey-core), all those jars are "specification" jars. The JAX-RS (as well as many other Java) specifications define contracts (or interfaces) that implementators should implement the specified behavior for.

因此,基本上,规范中指定的所有类都应作为合同包含在jar中.罐子的最终用户可以将其用于合同.但没有实现.尽管规范API jar足以编译一个完整的符合JAX-RS的应用程序,但您仍需要一个实际的实现来运行该应用程序.

So basically all the classes specified in the specification should be in the jar as contracts. End users of the jars can use them for the contracts. but there is no implementation. You need to have an actually implementation to run the application, though the spec API jar is enough to compile a complete JAX-RS compliant application.

例如,如果我们在类路径上有这些规范API jar之一,则可以编写一个完整的JAX-RS应用程序并进行编译,但是为了运行它,如果没有实际的实现,我们可以需要部署到具有该规范版本实际实现的服务器,例如JBoss或Glassfish

For example, if we have one of those spec API jars on the classpath, we can author an entire JAX-RS application and compile it, but in order to run it, if we don't have the actual implementation, we need to deploy to a server that has the actual implementation of that spec version, for example JBoss or Glassfish

  • jaxrs-api -这是 RESTeasy的包装.它不是官方规格罐,但确实符合规格合同. RESTeasy在整个规格行中使用此jar,即1.x-当前版本.尽管jar确实改变了内部结构,以适应不同的JAX-RS版本.

  • jaxrs-api - This is RESTeasy's packaging of the spec. It is not the official spec jar, but it does adhere to the spec contracts. RESTeasy uses this jar for the entire spec line, i.e. 1.x - current. Though the jar does change internals to adhere to the different JAX-RS versions.

jsr311-api -这是JAX-RS 1.x产品线的正式规格.

jsr311-api - This is the official spec jar for the JAX-RS 1.x line.

javax.ws.rs-api -这是JAX-RS 2.x产品线的正式规格.

javax.ws.rs-api - This is the official spec jar for the JAX-RS 2.x line.

球衣核心-这是该规范的部分实现.该实现的其余部分包含在其他Jersey jar中.请注意,在Jersey的早期版本中,他们实际上将JAX-RS规范API打包到此jar中.直到后来,泽西岛才开始使用官方规格罐.

jersey-core - This is a partial implementation of the spec. The rest of the implementation is contained inside other Jersey jars. Note that in earlier versions of Jersey, they actually packaged the JAX-RS spec APIs into this jar. It wasn't until later that Jersey started using the official spec jars.

jaxrs-ri -这是打包到一个jar中的完整的Jersey 2.x实现. "ri"表示参考实现,它是Jersey的名称:JAX-RS参考实现.如果您没有使用像Maven这样的依赖项管理器,则可能只想使用这个单一的jar,而不必使用Jersey随附的所有单独的jar.

jaxrs-ri - This is the complete Jersey 2.x implementation packaged into one jar. The "ri" mean reference implementation, which is what Jersey is: the JAX-RS reference implementation. If you are not using a dependency manager like Maven, you might want to just use this single jar instead of having to use all the separate jars that Jersey comes with.

其他资源

  • Java API for RESTful Services (JAX-RS) to read details of the different spec versions.
  • Complete implementation for RESTeasy distribution. RESTeasy 3.x line if the JAX-RS 2.x implementation, and RESTeast 2.x/1.x id for the JAX-RS 1.x line
  • Complete distribution of Jersey implementation. You can find the JAX-RS 2.x implementation in the "Jersey JAX-RS 2.0 RI bundle" link at the top of the page. There is also at the bottom links to the Jersey 1.x line distribution, which adheres to the JAX-RS 1.x spec.

还请注意,尽管规格遵循不同的实现方式,但是每个实现方式都有其自己的一组额外功能.要了解更多信息,您应该阅读不同实现的文档.三种最受欢迎​​的实现是 Jersey

Also note that though different implementation adhere to the spec, each implementation has its own set of extra features. To learn more you should go through the documentation of the different implementation. The three most popular implementations are Jersey, RESTeasy, and CXF

这篇关于jaxrs-api VS jsr311-api VS javax.ws.rs-api VS球衣核心VS jaxrs-ri的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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