我正在休息调用返回多部分/混合有效负载的 endpoints .

这是使用Spring的RestTemplate的调用:

ResponseEntity<String> res = template.exchange(queryStr, HttpMethod.GET, entity, String.class);

我知道我可以从ResponseEntity中获取整个身体作为一个字符串,但我没有更优雅的方式来处理multipart / mixed的 parsing . 我尝试过这样的事情:

ResponseEntity<MultipartFile> res = template.exchange(queryStr, HttpMethod.GET, entity, MultipartFile.class);

但我得到这个例外:

org.springframework.web.client.RestClientException无法提取响应:没有为响应类型找到合适的HttpMessageConverter [interface org.springframework.web.multipart.MultipartFile]和内容类型[multipart / mixed; boundary = ML_BOUNDARY_10842596526049964806]

思考?