https://www.poi86.com/poi/download_street_geojson/22054.html 这个页面资源,通过 Resttemplate 获取,Resttemplate 表单提交获取文件,返回 302,Transfer-Encoding:"chunked",获取到数据为 null,这是为啥啊,这是我核心代码:
//设置为 form 方式
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set("Accept-Encoding","gzip, deflate, br");
headers.set("Content-Length","27");
headers.set("Connection","keep-alive");
//设置请求参数
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("streetid", adcode);
parameters.add("Captcha", captcha);//
https://www.poi86.com/poi/download_street_geojson/25357.htmlHttpEntity<MultiValueMap<String, String>> multiValueMapHttpEntity = new HttpEntity<>(parameters, headers);
ResponseEntity<byte[]> result = restTemplate.postForEntity(GEO_URL_PREFIX + "/GeoJson/Street", multiValueMapHttpEntity, byte[].class);
求解决方案,