我正在尝试使用apache camel blueprint设置一个servlet并在karaf(jetty)上运行。
我在我的" blueprint.xml":
中得到了这个<reference id="httpService" interface="org.osgi.service.http.HttpService" />
<bean class="org.apache.camel.component.servlet.osgi.OsgiServletRegisterer"
init-method="register" destroy-method="unregister">
<property name="alias" value="/Somepath" />
<property name="httpService" ref="httpService" />
<property name="servlet" ref="notifyServlet" />
</bean>
<bean id="notifyServlet"
class="org.apache.camel.component.servlet.CamelHttpTransportServlet" />
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<restConfiguration component="servlet" port="8080"
contextPath="/Somepath" bindingMode="json">
<dataFormatProperty key="prettyPrint" value="true" />
</restConfiguration>
<rest path="/restpath" consumes="application/json" produces="application/json">
<post uri="/someuri">
<to uri="direct:process" />
</post>
</rest>
[...]
</camelContext>
但是当我尝试用POST调用servlet url时,我总是得到#34; 405方法不允许&#34;在我的Karaf日志中,我得到以下内容:
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Len': was expecting ('true', 'false' or 'null') at [Source:java.io.ByteArrayInputStream@1e1ca883; line: 1, column: 5]
我通过POST发送的参数是&#34; Len&#34;和&#34;数据&#34;。
还有什么我需要配置才能使这项工作?只是无法弄清楚......