| | |
| | | package com.genersoft.iot.vmp.media.zlm; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import okhttp3.*; |
| | | import okhttp3.logging.HttpLoggingInterceptor; |
| | |
| | | if (callback == null) { |
| | | try { |
| | | Response response = client.newCall(request).execute(); |
| | | |
| | | if (response.isSuccessful()) { |
| | | ResponseBody responseBody = response.body(); |
| | | if (responseBody != null) { |
| | |
| | | responseJSON = JSON.parseObject(responseStr); |
| | | } |
| | | }else { |
| | | System.out.println( 2222); |
| | | System.out.println( response.code()); |
| | | response.close(); |
| | | Objects.requireNonNull(response.body()).close(); |
| | | } |
| | |
| | | |
| | | if(e instanceof SocketTimeoutException){ |
| | | //读取超时超时异常 |
| | | logger.error(String.format("读取ZLM数据失败: %s, %s", url, e.getMessage())); |
| | | logger.error(String.format("读取ZLM数据超时失败: %s, %s", url, e.getMessage())); |
| | | } |
| | | if(e instanceof ConnectException){ |
| | | //判断连接异常,我这里是报Failed to connect to 10.7.5.144 |
| | | logger.error(String.format("连接ZLM失败: %s, %s", url, e.getMessage())); |
| | | logger.error(String.format("连接ZLM连接失败: %s, %s", url, e.getMessage())); |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | |
| | | .build(); |
| | | Response response = client.newCall(request).execute(); |
| | | if (response.isSuccessful()) { |
| | | logger.info("response body contentType: " + Objects.requireNonNull(response.body()).contentType()); |
| | | if (targetPath != null) { |
| | | File snapFolder = new File(targetPath); |
| | | if (!snapFolder.exists()) { |