Java – how to call restful services through Apache camel?

I am currently using the HTTP method to call some URLs that will create JIRA problems

Now I want to use Apache camel. How can I use it?

I need to call the following link through camel:

http://localhost:8080/rest/api/2/project/" + key + /components

When I first came into contact with camels, please put forward some solutions and examples

thank you

Solution

You can easily use cxfrs component; If you need to use HTTP component, you can easily use it for some reasons:

<setHeader headerName="CamelHttpUri">
      <simple>http://localhost:8080/rest/api/2/project/${header.myKey}/components</simple>
</setHeader>
<inOut uri="http://doesnt.matter.we/override/it/anyways" />

Of course, you need to use the MyKey header to enrich your messages before entering this part of the route

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>