不能在实体的属性值中使用括号 ( )
Can't use parenthesis ( ) in an entity's attribute value
过去几天我一直在试验 Orion,一段时间后我让它按照我想要的方式工作。
我遇到了一个意想不到的烦恼,给定实体上下文的字符串属性将无法注册。
示例:
http POST [my_orion_server_url]:1026/v1/updateContext < create_push.json
其中 create_push.json 是:
{
"contextElements": [
{
"type": "Push",
"isPattern": "false",
"id": "Push1",
"attributes": [
{
"name": "message",
"type": "string",
"value": "this is a test)"
}
]
}
],
"updateAction": "APPEND"
}
服务器回复:
HTTP/1.1 200 OK
Content-Length: 129
Content-Type: application/json
Date: Thu, 19 Nov 2015 11:47:03 GMT
{
"errorCode": {
"code": "400",
"details": "Illegal value for JSON field",
"reasonPhrase": "Bad Request"
}
}
另一方面,如果我删除括号,一切都会按预期进行:
json 文件:
{
"contextElements": [
{
"type": "Push",
"isPattern": "false",
"id": "Push1",
"attributes": [
{
"name": "message",
"type": "string",
"value": "this is a test"
}
]
}
],
"updateAction": "APPEND"
}
服务器响应:
{
"contextResponses": [
{
"contextElement": {
"attributes": [
{
"name": "message",
"type": "string",
"value": ""
}
],
"id": "Push1",
"isPattern": "false",
"type": "Push"
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
]
}
这是故意的还是错误?
我可以克服用其他东西对括号进行编码然后在接收时解码的问题,但是能够直接用实体发送括号会更顺畅,也不会那么烦人。
这是预期的行为。请看Orion documentation.
过去几天我一直在试验 Orion,一段时间后我让它按照我想要的方式工作。
我遇到了一个意想不到的烦恼,给定实体上下文的字符串属性将无法注册。
示例:
http POST [my_orion_server_url]:1026/v1/updateContext < create_push.json
其中 create_push.json 是:
{
"contextElements": [
{
"type": "Push",
"isPattern": "false",
"id": "Push1",
"attributes": [
{
"name": "message",
"type": "string",
"value": "this is a test)"
}
]
}
],
"updateAction": "APPEND"
}
服务器回复:
HTTP/1.1 200 OK
Content-Length: 129
Content-Type: application/json
Date: Thu, 19 Nov 2015 11:47:03 GMT
{
"errorCode": {
"code": "400",
"details": "Illegal value for JSON field",
"reasonPhrase": "Bad Request"
}
}
另一方面,如果我删除括号,一切都会按预期进行:
json 文件:
{
"contextElements": [
{
"type": "Push",
"isPattern": "false",
"id": "Push1",
"attributes": [
{
"name": "message",
"type": "string",
"value": "this is a test"
}
]
}
],
"updateAction": "APPEND"
}
服务器响应:
{
"contextResponses": [
{
"contextElement": {
"attributes": [
{
"name": "message",
"type": "string",
"value": ""
}
],
"id": "Push1",
"isPattern": "false",
"type": "Push"
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
]
}
这是故意的还是错误?
我可以克服用其他东西对括号进行编码然后在接收时解码的问题,但是能够直接用实体发送括号会更顺畅,也不会那么烦人。
这是预期的行为。请看Orion documentation.