resttemplate使用记录1
使用resttemplate批量上传文件
MultiValueMap multiValueMap = new LinkedMultiValueMap();
for (String file : files) {
FileSystemResource resource = new FileSystemResource(new File(file));
multiValueMap.add(file, resource);
}
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setContentType(MediaType.MULTIPART_FORM_DATA);
HttpEntity<MultiValueMap> body = new HttpEntity<>(multiValueMap, httpHeaders);
JSONArray jsonArray = restTemplate.postForObject(postUrl, body, JSONArray.class);
                    
                
                
            
        
浙公网安备 33010602011771号