| | |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.core.model.command.NyShuttleHttpCommand; |
| | | import com.zy.core.model.protocol.NyShuttleProtocol; |
| | | import springfox.documentation.spring.web.json.Json; |
| | | |
| | | import java.io.*; |
| | | import java.net.Socket; |
| | |
| | | } |
| | | } while (response != null); |
| | | // System.out.println("Received response from server: " + sb); |
| | | return JSON.parseObject(sb.toString()); |
| | | |
| | | JSONObject result = JSON.parseObject(sb.toString());//得到响应结果集 |
| | | if (!result.get("msgType").equals("responseMsg")) {//不是响应内容 |
| | | return null; |
| | | } |
| | | |
| | | JSONObject resultResponse = JSON.parseObject(result.get("response").toString()); |
| | | JSONObject resultHeader = JSON.parseObject(resultResponse.get("header").toString()); |
| | | int responseId = Integer.parseInt(resultHeader.get("responseId").toString()); |
| | | if (responseId != httpCommand.getRequest().getHeader().getRequestId()) { |
| | | return null;//响应ID与请求ID不一致 |
| | | } |
| | | |
| | | return filterBodyData(result);//返回Body结果集 |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static JSONObject filterData(JSONObject data) { |
| | | public static JSONObject filterBodyData(JSONObject data) { |
| | | Object response = data.get("response"); |
| | | if (response == null) { |
| | | return null; |