在 Eclipse 上安装和使用 Jersey
在我的 Web 服务中,我使用 eclipse、java 1.5、spring。现在我想使用球衣进行 REST 并从以下地址将球衣作为捆绑包下载:
http:// jersey.java.net/nonav/documentation/latest/chapter_deps.html
如何将此 jar 添加到我的项目中并开始使用 JAX-rs 注释,我添加到了 buildpath 但似乎不起作用。
另外,创建我的资源类的 JAXB 带注释的类并将它们与 JERSEY 一起使用是否有必要或者是个好主意?
In my Web service I use eclipse, java 1.5, spring. now I want to use jersey for REST and downloaded the jersey as a bundle jar from this address:
http://jersey.java.net/nonav/documentation/latest/chapter_deps.html
How can I add this jar to my project and start using the JAX-rs annotations, I added to buildpath but seems like does not work.
Also is it necessary or a good idea to create JAXB annotated classes of my resource classes and using them with JERSEY?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保类路径上有 jsr-311 jar。
例如,您可以从此处。
Jersey 支持开箱即用的 JAXB。这并不意味着您必须使用 JAXB。如果您需要将数据序列化到 xml 或从 xml 序列化数据,则将 JAXB 与 Jersey 结合使用是最方便的。
Make sure you have jsr-311 jar on your classpath.
For example you can download it from here.
Jersey supports JAXB out-of-the-box. It doesn't mean you have to use JAXB. If you need to serialize data to/from xml, using JAXB with Jersey is the most convenient.