Java的球衣,JAX RS [英] Java- Jersey, JAX RS

查看:164
本文介绍了Java的球衣,JAX RS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些经验,开发Java程序。但是我一直在努力了解一些基础知识,如各种不同的组件,使一个Java企业应用程序。

例如我已经实现REST风格和从一个J2ME应用程序,并进行性能和成本测试我的MSC消耗基于SOAP的Web服务。

要开发REST风格/基于SOAP的Web服务中,我使用NetBeans中的向导功能。它使用JAX-RS来实现REST Web服务。然后,我看到使用JAX-RS与新泽西等我经常迷失在专业术语,如API的,应用程序框架,配置文件,Java版等等等等。这里有几个问题,其他教程


  1. JAX-RS 是一个API。
    基本上是一个API来实现某种形式的Java功能库的集合?


  2. 据他们的网站 泽西是开源的,生产质量,JAX-RS(JSR 311),用于构建RESTful Web服务的参考实现。的新泽西州是另一个API或者它与JAX-RS一起使用时,和最新两者之间的区别?


  3. 我如何认识到如果事实上我已经实现了这样的API和知道,如果我需要他们?


当我决定实现REST Web服务,我只是跟着一个NetBeans教程和向导提供了方便快捷的开发时间。据我所知,奇才队使用,因为它们是快速和做的工作。
但是我不知道,当你给code的任务。你怎么知道是什么的API,框架,插件等使用。什么版本的Java兼容的库等。
难道只是我还是你迷路的时候?还是将来自经验。

感谢您抽出宝贵时间来阅读:)


解决方案

  1. JAX-RS不仅仅是一个API的更多。这是一个 Java规范请求(JSR)。那些定义必须由实现所支持的API和行为。如果你写你的code使用由JSR定义的API,那么你可以选择在运行时使用哪种实现。


  2. 篮网是code,可提供由的 JSR 311 。调用它的参考实现表明它是由JSR的创造者的支持,很可能与甲骨文的软件捆绑在一起。 JSR 311的其他实现还包括的的Restlet CXF 和<一个HREF =htt​​p://www.jboss.org/resteasy相对=nofollow称号=RestEasy的> RestEasy的。


  3. 通常情况下,你会用我上面2号提到,实现了规范的第三方库。你可能会认为自己实现它的唯一原因是,如果一个合适的实现不存在。


只有这样,才能找出哪些API和规范可以帮助你通过一个发现过程真的。的JSR是为了是定义一个通用的问题的解决方案,你可以选择最适合您的实现的常用方法。

I've some experience developing Java programs. However I have always struggled to understand some basics, such as all the different components that make up a Java Enterprise Application.

For example I have implemented RESTful and SOAP based Web services that are consumed from a J2ME application and performed performance and costing tests for my MSC.

To develop the RESTful/SOAP based Web services, I used the wizard functionality in Netbeans. It uses JAX-RS to implement the REST web services. Then I see other tutorials that use JAX-RS with Jersey etc. I often get lost in the jargon such as API's, application frameworks, configuration files, Java edition and so on etc. Here are a few questions

  1. JAX-RS is an API. Is an API basically a collection of libraries used to implement some form of functionality in Java?

  2. According to their site "Jersey is the open source, production quality, JAX-RS (JSR 311) Reference Implementation for building RESTful Web services." Is Jersey another API or is it used in conjunction with JAX-RS, and whats the difference between the two?

  3. How do I recognise if in fact I have implemented such API's and know if I need them?

When I decided to implement RESTful web services, I just followed a Netbeans tutorial and the wizards provided easy and quick development time. I understand that wizards are used because they are quick and do the job. However I wonder, when you are given a task to code. How do you know what API's, frameworks, add-ons etc to use. What edition of Java is compliant with the libraries etc. Is it just me or do you get lost at times? Or will this come from experience.

Thanks for taking the time to read :)

解决方案

  1. JAX-RS is more than just an API. It is a Java Specification Request (JSR). Those define the API and behaviors that must be supported by an implementor. If you write your code to use the API defined by the JSR then you can choose which implementation to use at runtime.

  2. Jersey is code that provides the behavior dictated by JAX-RS defined by JSR 311. Calling it the reference implementation indicates that it is supported by the creators of the JSR and is probably bundled with Oracle's software. Other implementations of JSR 311 also include Restlet, CXF, and RESTEasy.

  3. Typically you would use a 3rd party library that implements the specification as I mentioned in number 2 above. The only reason you might consider implementing it yourself is if a suitable implementation did not exist.

The only way to find out what APIs and specifications can help you is through a discovery process really. JSRs are meant to be a common approach to defining a solution for a generic problem where you can choose the implementation that works best for you.

这篇关于Java的球衣,JAX RS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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