嗨,我必须发送带有这些参数的resttemplate.exchange的POST请求
{
"tipoPortafoglio": "string",
"allegatiPratica": [
{
"fileName": "string",
"body": "string",
"mimeType": "string"
}
]
}
我有一个映射的类,称为
Public class CreateRichiesta {
String tipoPortafoglio
Allegato allegatiPratica //<===== Custom type defined as JSON
//Getter and setters
由于自定义类型的存在,我无法通过HashMap将实体传递给RestTemplate.Exchange。>
Map<String,String> input = new HashMap<>(); input.put("tipoPortafoglio", request.getTipoPortafoglio()); input.put("allegatiPratica", request.getAllegatiPratica()));
getAllegatiPratica不是字符串类型,而是Allegato类型
我该怎么办?感谢所有人
[嗨,我必须发送带有resttemplate.exchange的POST请求,这些请求带有这些参数{“ tipoPortafoglio”:“ string”,“ allegatiPratica”:[{“ fileName”:“ string”,“ body”:“ string”,.. 。
HttpEntity<CreateRichiesta> request = new HttpEntity<>(new CreateRichiesta());
ResponseEntity<CreateRichiestaResponse> responseEntityObj = restTemplate.
.exchange(resourceUrl, HttpMethod.POST, request, CreateRichiestaResponse.class);