0

我需要从一种资源中获取数据。简单的 GET 请求需要不完整的数据集,这就是为什么用户应该使用 UI(复选框)阐明需要哪些数据。我总是需要所有数据,这就是我从浏览器控制台保存表单数据的原因。未解析的表单数据看起来像(这只是表单数据的一部分):

lineObjectIds=0&lineObjectIds=3301&lineObjectIds=30611&columnObjectIds=3&columnObjectIds=33560&selectedFilterIds=0_59554&selectedFilterIds=3_2019&selectedFilterIds=3_2020&selectedFilterIds=3301_70583&selectedFilterIds=3301_70584&selectedFilterIds=3301_70585&selectedFilterIds=3301_70586&selectedFilterIds=3301_70587&selectedFilterIds=3301_70588&

我试过的:

HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); //Also tried MULTIPART_FORM_DATA
MultiValueMap<String, String> map = fillMap(headerValues); //fillMap method parses form-data presented above and transform it to {key - param}
HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(map, headers);
ResponseEntity<String> response = restClient.postForEntity(url, httpEntity, String.class);

远程资源会忽略我的表单数据并为我提供不完整的数据。我究竟做错了什么?有人可以帮我解决这样的问题吗

4

0 回答 0