当与servlet引擎集成时,Apache camel restlet无法正常工作

时间:2016-01-05 19:11:52

标签: apache-camel restlet-2.0

我正在尝试将restlet与servlet引擎集成,以便我不会产生新的服务器进程。

我在web.xml中进行了以下配置

<span>#: foo #</span>
<script id="index" type="text/x-kendo-template">
   <span>#: foo #</span>
</script>

在我的spring applicationContext.xml中,我有以下条目,

 <servlet>
        <servlet-name>spring-rs</servlet-name>
        <servlet-class>org.restlet.ext.spring.SpringServerServlet</servlet-class>
        <init-param>
            <param-name>org.restlet.Component</param-name>
            <param-value>RestletComponent</param-value>
        </init-param>



        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>spring-rs</servlet-name>
        <url-pattern>/restful/*</url-pattern>
    </servlet-mapping> 

但是当我尝试调用restful服务时,我收到以下错误。

 <bean name = "RestletComponent" id="RestletComponent" class="org.restlet.Component" />
    <bean name = "RestletComponentService" id="RestletComponentService" class="org.apache.camel.component.restlet.RestletComponent">
        <constructor-arg index="0">
            <ref bean="RestletComponent" />
        </constructor-arg>
    </bean>

<camelContext xmlns="http://camel.apache.org/schema/spring">

<route id = "RS_getdata">
            <from uri="restlet:/getData?restletMethod=POST" />
</camelContext>

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

您应该将您的bean命名为与组件名称相同的名称,以便Camel使用它,例如:

<bean name = "RestletComponent" id="RestletComponent" 

应该是

<bean name = "restlet" id="restlet"