2016-09-19 47 views
0

權不是我可以映射單個消費者單個休息服務按下面的代碼:是否有可能捕獲單個消費者的所有休息請求,並使用cxfrs轉發到實際的休息Web服務?

路由配置:

<bean class="com.x.ws.integration.route.SampleRouteProcessor" 
    id="sampleRouteProcessor" /> 
<camel:routeContext id="xyz"> 
    <camel:route xmlns="http://camel.apache.org/schema/spring"> 
     <camel:from 
      uri="cxfrs:bean:getSampleHoliDay?bindingStyle=SimpleConsumer" /> 
     <camel:setHeader headerName="CamelHttpMethod"> 
      <constant>GET</constant> 
     </camel:setHeader> 
     <camel:setHeader headerName="Content-Type"> 
      <constant>application/json</constant> 
     </camel:setHeader> 
     <camel:setHeader headerName="accept"> 
      <constant>application/json</constant> 
     </camel:setHeader> 

     <camel:to uri="cxfrs:bean:getSampleHoliDayClient" /> 
    </camel:route> 
</camel:routeContext> 
<cxf:rsServer id="getSampleHoliDay" loggingFeatureEnabled="true" 
    serviceClass="com.nucleus.rest.consumer.RestConsumerImpl"> 

    <cxf:providers> 
     <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" /> 
    </cxf:providers> 
</cxf:rsServer> 
<!--Create receipt REST service Producer service client --> 
<cxf:rsClient id="getSampleHoliDayClient" 
    address="http://10.*.*.*:*/sample-integration/rest/" 
    loggingFeatureEnabled="true"> 
    <cxf:providers> 
     <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" /> 

    </cxf:providers> 
</cxf:rsClient> 

消費者在集成:

import java.util.Map; 
import javax.ws.rs.GET; 
import javax.ws.rs.Path; 
import javax.ws.rs.Produces; 
import javax.ws.rs.core.MediaType; 

@Path("/") 
public interface RestConsumer 
{ 

    @GET 
    @Path("/getSampleRequest") 
    @Produces(MediaType.APPLICATION_JSON) 
    public Map<String, Object> getSampleResponse(); 
} 

現在,如果我做@Path (「/ *」)它不起作用。我想創建一個RestConsumer,它應該能夠捕獲所有的休息請求並相應轉發。

回答