jaxrs-api VS jsr311-api VS javax.ws.rs-api VS jersey-core VS jaxrs-ri [英] jaxrs-api VS jsr311-api VS javax.ws.rs-api VS jersey-core VS jaxrs-ri

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

问题描述

我已经用谷歌搜索了很多,仍然对上述每个内容的确切含义感到困惑.

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 client):是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是一个规范请求.也就是说它应该是一个文档.为什么它是一个jar?"

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

除了最后一个(jersey-core),所有这些罐子都是规范"罐子.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 的 包装规范.它不是官方的规范 jar,但它确实遵守规范合同.RESTeasy 将这个 jar 用于整个规范行,即 1.x - current.尽管 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 系列的官方规范 jar.

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

javax.ws.rs-api - 这是 JAX-RS 2.x 行的官方规范 jar.

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

jersey-core - 这是规范的部分实现.其余的实现包含在其他 Jersey jars 中.请注意,在 Jersey 的早期版本中,他们实际上将 JAX-RS 规范 API 打包到这个 jar 中.直到后来,Jersey 才开始使用官方规范的 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.

另请注意,尽管不同的实现遵循规范,但每个实现都有自己的一组额外功能.要了解更多信息,您应该阅读不同实现的文档.三个最流行的实现是 JerseyRESTeasyCXF

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 jersey-core VS jaxrs-ri的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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