Zagraj w 2.0 Jak publikować dane wieloczęściowe przy użyciu WS.url lub WS.WSRequest

W żądaniu Http Java możemy to zrobić, aby wykonać wieloczęściowy HTTP POST.

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);

FileBody bin = new FileBody(new File(fileName));
StringBody comment = new StringBody("Filename: " + fileName);

MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("bin", bin);
reqEntity.addPart("comment", comment);
httppost.setEntity(reqEntity);

HttpResponse response = httpclient.execute(httppost);
HttpEntity resEntity = response.getEntity();

Jak mogę osiągnąć to samo za pomocą WS.url lub WS.WSRequest?

WSRequestHolder wsReq = WS.url("http//url");            
wsReq.setHeader("Content-type", "multipart/form-data");

questionAnswers(6)

yourAnswerToTheQuestion