HttpEntity httpEntity = MultipartEntityBuilder.create()
.addTextBody("name", "张三", ContentType.TEXT_PLAIN.withCharset(StandardCharsets.UTF_8))
.addBinaryBody("file", new File("C:\\Users\\123\\Desktop\\QQ截图20231010143306.png"))
.build();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
httpEntity.writeTo(byteArrayOutputStream);
byte[] multipartByteArray = byteArrayOutputStream.toByteArray();
// save multipartByteArray Log To Mysql
Request.post("")
.body(httpEntity);
I use httpEntity.writeTo() to turn MultipartEntity into byte[] and store it in mysql as a log record. So when I want to view all parameters in this MultipartEntity request, what method should I use? Or how to turn this byte into LinkedMultiValueMap<String, Part>?