How can I make a multipart/form-data POST request using Java?
Как я могу сделать POST-запрос multipart / form-data с использованием Java?
Во времена версии 3.x Apache Commons HttpClient выполнение POST-запроса, состоящего из нескольких частей / данных формы, было возможно (пример 2004 г.). К сожалению, это больше невозможно в версии 4.0 HttpClient.
Для нашего основного действия "HTTP" multipart несколько выходит за рамки. Мы хотели бы использовать составной код, поддерживаемый каким-либо другим проектом, для которого он входит в область действия, но я не знаю ни одного. Несколько лет назад мы пытались перенести составной код в commons-codec, но у меня ничего не вышло. Олег недавно упомянул другой проект с составным кодом синтаксического анализа, и его может заинтересовать наш составной код форматирования. Я не знаю текущего состояния этого. (http://www.nabble.com/multipart-form-data-in-4.0-td14224819.html)
Кто-нибудь знает о какой-либо библиотеке Java, которая позволяет мне написать HTTP-клиент, который может выполнять POST-запрос multipart / form-data?
// This attaches the file to the POST: Filef=newFile("[/path/to/upload]"); builder.addBinaryBody( "file", newFileInputStream(f), ContentType.APPLICATION_OCTET_STREAM, f.getName() );