1. 程式人生 > 其它 >人臉識別裝置從伺服器下載裝置一直失敗的兩點原因

人臉識別裝置從伺服器下載裝置一直失敗的兩點原因

下載就是簡單的圖片下載,返回給裝置的json如下:

{
    "data": {
        "users": [
            {
                "creation_time": 1623225536000,
                "last_modified_time": 1623225536000,
                "is_deleted": false,
                "person_ext_info": {},
                "person_name": "xxx",
                
"faces": [ { "face_id": 67, "face_img_url": "http://192.168.2.10:8082/device/face_image?userkey=67" } ], "person_id": 67 }, { "creation_time": 1623225536000,
"last_modified_time": 1623225536000, "is_deleted": false, "person_ext_info": {}, "person_name": "xxxx", "faces": [ { "face_id": 60, "face_img_url": "http://192.168.2.10:8082/device/face_image?userkey=60" } ],
"person_id": 60 } ] }, "success": true, "message": "操作成功" }

這是本地的返回,上週就正常,但云伺服器失敗了一週.

第一個原因: GSON預設開啟html字元轉換,=60變成了 \U021s之類的.坑爹啊,關鍵本地也沒關html字元轉換,但它是正常的!這可能就是作業系統不一樣導致的.

第二個原因:伺服器用了nginx代理,https在nginx上,到tomcat裡獲取的request.getScheme()是http,導致拼出的網址裝置拿來請求無法下載圖片,犀利的是瀏覽器自動識別,一直都能下載圖片[捂臉哭]