Skip to content

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

img_1.png

使用curl请求接口:

$ curl http://localhost:6636/api/return
$ curl http://localhost:6636/api/return

接口返回:

json
this is a text
this is a text

输出指定变量

data输入:#{body}

img_2.png

使用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数据中使用流程变量

img_3.png

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"
}