【发布时间】:2022-01-03 14:29:33
【问题描述】:
哎呀,伙计们!美丽?我试图在我的 Rest 模板的响应中获取一个字节列表 [],但我的交换不接受新的 ParameterizedTypeReference>() {},有人可以帮我吗?
ResponseEntity<List<byte[]>> response = null;
try {
response = restTemplate.exchange(parametros.get("SERVICE_HUB2_BASE_URL") + "/fw/v1/pdf/kms/assinaturas",
HttpMethod.POST, entity, new ParameterizedTypeReference<List<byte[]>>() {});
} catch (HttpServerErrorException e) {
e.printStackTrace();
throw new ClientException(e.getStatusCode().value(), e.getStatusText());
} catch (HttpClientErrorException e) {
e.printStackTrace();
throw new ClientException(e.getStatusCode().value(), e.getStatusText());
} catch (Exception e) {
e.printStackTrace();
}
【问题讨论】:
-
exchange有 eight(!) 个重载,请更精确/使用最合适的方法! ;)