Apache CXF / JAX-RS,Felix和Jetty [英] Apache CXF/JAX-RS, Felix and Jetty

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

问题描述

我有一组现有的捆绑软件,它们一起创建了一个Web应用程序(包括Jetty实例)。一个新的要求是扩展此应用程序以提供一个RESTful api(使用JAX-RS)。

I have an existing group of bundles that together create a web application (including an instance of Jetty). A new requirement is to extend this application to provide a RESTful api (using JAX-RS).

我能够孤立地开发大多数RESTful API从其余的应用程序。我没有意识到,我使用的Apache CXF捆绑包包含其自己的Jetty实例。因此,孤立地来说,这很好。当我合并应用程序的两半时,两个实例的地址发生冲突。

I was able to develop the majority of the RESTful API in isolation, away from the rest of the applciation. Without realising, the Apache CXF bundle I was using contained its own Jetty instance. So, in isolation, this worked fine. When I merged the two halves of the application, the two instances' addresses conflicted.

我肯定知道这一点。

我不知道如何重新配置​​应用程序(JAX-RS)的RESTful API部分以使用现有的Jetty实例。 此页面建议使用CXFServlet,但我找不到很多信息。

What I do not know is how to re-configure the RESTful API part of the application (JAX-RS) to use the existing Jetty instance. This page suggests the use of CXFServlet, but I cannot find much information on this.

有人可以给我一些启示或指向正确的方向吗?

Could anybody shed some light or point me in the right direction?

编辑:我还应该提到,当前,我的端点使用Java接口中的JAX-RS批注在端点和映射的类之间进行映射。我希望保留此配置方法,而不是XML或任何其他方法。

I should also mention that, currently, my endpoints use the JAX-RS annotations in a Java interface to map between an endpoint and mapped class. I would prefer to keep this configuration method as opposed to XML or any other method.

推荐答案

一个不使用Apache的选项CXF用于使用Amdatu的Web组件,该组件也支持JAX-RS批注。您可以在 http://amdatu.org/components/web.html 中找到有关它们的更多文档。这说明了如何使用单独的Jetty实例设置项目。您可能还想在 http://amdatu.org/howto/createwebapp.html

One option, which does not use Apache CXF, is to use the web components of Amdatu, which also support JAX-RS annotations. You can find more documentation about them at http://amdatu.org/components/web.html which explains how to setup your project with a separate Jetty instance. You might also want to watch the video at http://amdatu.org/howto/createwebapp.html which deals with the same subject.

如果您真的想使用Apache CXF,则有两个版本:一个多合一,完全是独立的(因此也包括Jetty)和一个模块化的模块,它由许多单独的束组成。从理论上讲,后者使您可以选择与自己的Jetty副本集成,但是您需要根据 http://cxf.apache.org/docs/index.html

If you really want to use Apache CXF, there are two versions: an "all in one" that is pretty much self-contained (and therefore also includes Jetty) and a "modular" one that consists of many separate bundles. The latter in theory gives you the option to integrate with your own copy of Jetty, but you need to figure out what exact set of bundles you need based on their documentation at http://cxf.apache.org/docs/index.html

这篇关于Apache CXF / JAX-RS,Felix和Jetty的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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