Appearance
Return
Http流程的数据输出控件,服务运行时该控件执行完毕后结束所属的流程。
业务属性
属性 | 含义 | 说明 | 输入限定 | 示例值 |
---|---|---|---|---|
enable | 是否启用该控件,未启用时不编译 | 是否编译 | 选择值 | 启用 |
text | 与控件关联的文本 | 设计页控件显示 | 常量 | return |
dataType | 数据类型 | 表明http请求返回内容的数据类型(headers中的体现) | 选择值 | JSON |
data | 返回数据 | http请求的返回数据 | 常量,Json/Xml数据节点可用流程变量 /流程变量 | {”data“:"#{returnValue}"} |
当data属性数据,符合Json/Xml格式时,在数据节点可用流程变量。
数据中使用的变量会被反序列化为当前数据格式(Json/Xml)的数据。
使用示例
输出常量
data输入:this is a text

使用curl请求接口:
$ curl http://localhost:6636/api/return
$ curl http://localhost:6636/api/return
接口返回:
json
this is a text
this is a text
输出指定变量
data输入:#{body}

使用curl请求接口:
$ curl http://localhost:6636/api/return -d "{\"text\":\"this is a text from body\"}"
$ curl http://localhost:6636/api/return -d "{\"text\":\"this is a text from body\"}"
接口返回:
json
{
"text": "this is a text from body"
}
{
"text": "this is a text from body"
}
body
为http请求中的body参数,#{body}
将直接输出body参数
Json/Xml数据中使用流程变量

data输入:
json
{
"foo":"custom data",
"text":"#{body.text}"
}
{
"foo":"custom data",
"text":"#{body.text}"
}
使用curl请求接口:
$ curl http://localhost:6636/api/return -d "{\"text\":\"this is a text from body\"}"
$ curl http://localhost:6636/api/return -d "{\"text\":\"this is a text from body\"}"
接口返回:
json
{
"foo": "custom data",
"text": "this is a text from body"
}
{
"foo": "custom data",
"text": "this is a text from body"
}