内容类型不支持骆驼DELETE方法? [英] Content-Type is not supported in Camel DELETE method?
问题描述
如何在骆驼发送内容类型的删除方法。我已经添加了以下方法,但它不能正常工作。
How do i send content-type in Camel DELETE method. I have added the following way but It was not working correctly.
from("direct:start")
.setHeader(Exchange.HTTP_METHOD, simple("DELETE"))
.setHeader(Exchange.CONTENT_TYPE, simple("application/xml"))
.setHeader(Exchange.HTTP_URI, simple("http://02.02.02.02:8080/rest/delete/student/688187"))
.to("http://emptyhost");
你能帮我解决这个问题?
推荐答案
的 Exchange.CONTENT_TYPE
属性
请尝试
from("direct:start")
.setHeader(Exchange.HTTP_METHOD, simple("DELETE"))
.to("http://02.02.02.02:8080/rest/delete/student/688187");
或
from("direct:start")
.to("restlet:http://02.02.02.02:8080/rest/delete/student/688187?restletMethod=delete");
顺便说一句,使用删除
中的URL不是RESTful方式,应ommited。
By the way, using delete
in the URL is not the RESTful way and should be ommited.
编辑:
骆驼不主体转移到 DELETE
操作的请求,可以看出挖掘到源$ C $ C。使用 PUT
操作,而不是。
见我的回答你的其他<一href=\"http://stackoverflow.com/questions/22876781/how-to-call-rest-api-delete-operation-with-body-content-from-apache-camel/22877338#22877338\">SO.
Camel does not transfer the body to the request of a DELETE
operation, as can be seen digging into the source code. Use a PUT
operation instead.
See my answer to your other SO.
这篇关于内容类型不支持骆驼DELETE方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!