具有一个Jetty端点的多个JAXRS Bean
有人能帮我用ApacheFuseESB配置两个具有相同基本URI的JAX-RS服务吗?我将JBoss FUSE 6.0版本与karaf容器、ApacheCamel和CXF(JAX-RS)一起使用。使用Blueprint完成配置。当我只配置一个JAX-RS服务时,一切正常 我试图用基本URI具有一个Jetty端点的多个JAXRS Bean,jetty,jax-rs,apache-camel,blueprint-osgi,Jetty,Jax Rs,Apache Camel,Blueprint Osgi,有人能帮我用ApacheFuseESB配置两个具有相同基本URI的JAX-RS服务吗?我将JBoss FUSE 6.0版本与karaf容器、ApacheCamel和CXF(JAX-RS)一起使用。使用Blueprint完成配置。当我只配置一个JAX-RS服务时,一切正常 我试图用基本URI为两个JAX-RSbean提供服务http://localhost:9001/rs。第一个bean为http://localhost:9001/rs/rest1和第二个带http://locahost:9001
为两个JAX-RSbean提供服务http://localhost:9001/rs
。第一个bean为http://localhost:9001/rs/rest1
和第二个带http://locahost:9001/rs/rest2
我已经用jetty端点定义了两个骆驼上下文。我想我需要两个实例,只使用一个配置的实例,但我不知道如何做到这一点
以下是我的背景:
<camel:camelContext id="context1">
<camel:endpoint id="ep1" uri="jetty:http://localhost:9001/rs/?matchOnUriPrefix=true"/>
<camel:route autoStartup="true">
<camel:from uri="ep1"/>
<camel:to uri="cxfbean:restBean1"/>
<camel:log message="Message received after REST Processor. "/>
<camel:convertBodyTo type="java.lang.String"/>
<camel:to uri="log:loggingCategory?level=INFO"/>
</camel:route>
</camel:camelContext>
<camel:camelContext id="context2">
<camel:endpoint id="ep2" uri="jetty:http://localhost:9001/rs/?matchOnUriPrefix=true"/>
<camel:route autoStartup="true">
<camel:from uri="ep2"/>
<camel:to uri="cxfbean:restBean2"/>
<camel:log message="Message received after REST Processor. "/>
<camel:convertBodyTo type="java.lang.String"/>
<camel:to uri="log:loggingCategory?level=INFO"/>
</camel:route>
</camel:camelContext>
这两个bean都作为服务引用被注入,当我对其中一条路由进行注释时,一切都正常
有没有关于如何在camel中配置的建议
干杯,
Oliver两个码头端点应该是唯一的,例如你有两个/rs/ 应该是这样的
<camel:endpoint id="ep1" uri="jetty:http://localhost:9001/rs/rest1/?matchOnUriPrefix=true"/>
<camel:endpoint id="ep2" uri="jetty:http://localhost:9001/rs/rest2/?matchOnUriPrefix=true"/>
我修复了两个端点的问题
<camel:endpoint id="ep1" uri="jetty:http://localhost:9001/rs/rest1/?matchOnUriPrefix=true"/>
<camel:endpoint id="ep2" uri="jetty:http://localhost:9001/rs/rest2/?matchOnUriPrefix=true"/>
其余的bean现在具有@Path(“/”
)。
现在,所有REST bean都有正确的路径
接下来我需要测试的是如何将我的两个端点与我的web应用程序包放在同一个URL上
谢谢 嗨。我认为解决方法是两个端点,其中包括bean的路径,并将bean路径设置为“/”。这适用于我的设置。