且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Camel发送multipart / form-data请求

更新时间:2022-02-09 21:57:48

您需要设置 Content-Type 标头,并在 MultipartEntityBuilder 中生成正确的边界。修改您的发件人处理器以设置此标头。

You need to set Content-Type header with correct boundary, which is generated in MultipartEntityBuilder. Modify your sender processor to set this header.

HttpEntity resultEntity = multipartEntityBuilder.build();
exchange.getOut().setHeader(Exchange.CONTENT_TYPE, resultEntity.getContentType().getValue());
exchange.getOut().setBody(resultEntity.getContent());