I have seen multiple ways to send a file using HttpPost. However, to send a file and other text parameters always seems to require the MultipartEntity object which is in the Apache Http components API.

In the version 4.3, MultipartEntity is deprecated

I have been looking in the documentation, without finding another solution to post multipart data. Either have I here.

I really don't want to use a deprecated object. Any hints?

有帮助吗?

解决方案

Usually, deprecated annotation are accompanied by a note explaining what to use instead. In this case :

Class MultipartEntity
(...)
Deprecated. 
4.3 Use MultipartEntityBuilder.

Which is documented here : http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntityBuilder.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top