如何在Mule中使用HTTP组件传递标头 [英] How to pass Headers using HTTP component in Mule

查看:154
本文介绍了如何在Mule中使用HTTP组件传递标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与Any Point Studio合作,我想通过键值对与当前请求一起传递标头如何使用现有的HTTP组件实现该目标.

Hi I am working with Any Point Studio and i want to pass headers with the current request with a key value pair How to achieve that using existing HTTP Component.

推荐答案

您可以通过Mule Client调用HTTP入站,这是一个示例:

You can invoke the HTTP Inbound through Mule Client, here is an example:

MuleClient muleClient = new MuleClient(muleContext);
Map<String, Object> headers = new HashMap<String, Object>(1);
headers.put("key", "456453N123");
MuleMessage result = muleClient.send("http://localhost:8081/prm", PAYLOAD, headers);

HTTP头位于MuleMessage的入站范围属性中.要从流中获取标题,可以使用:

The HTTP headers are in the inbound-scoped properties of the MuleMessage. To get the header from a flow, you can use:

<logger level="INFO" message="Header Content-Type = #[header:key]"/>

这篇关于如何在Mule中使用HTTP组件传递标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆