Questions tagged [multipartentity]

MultipartEntity is successor of HttpEntity, contained in HttpMime API since version 4.0. It's use is primary to simplify process of posting multipart content over HTTP. It allows to add multiple parts of different content-type and encoding.

MultipartEntity, part of HttpMime 4.0 and later. Allows you to put multiple parts, separated by boundary strings and encoded using given charset, into request.

It can have different modes, based on HttpMultipartMode constants. RFC Strict mode ( RFC 822, RFC 2045, RFC 2046 compliant ) and Browser compatible mode.

Each part of request is set via addPart(String name, ContentBody body) or addPart(FormBodyPart body) method.

Note that request, can have only one entity set, so all data must be fit in MultipartEntity object.

232 questions
56
votes
8 answers

Apache HttpClient Android (Gradle)

I have added this line to my build.gradle compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5' and I want to use MultipartEntityBuilder in my code. However Android studio doesn't add the library to my code. Can…
24
votes
2 answers

@Part parameters can only be used with multipart encoding. (parameter #8)

Before I post this question here, I have tried to add @Multipart above interface method And searching in stackoverflow still cannot find similar with my problem. In this case, I try to send image using TypedFile to server. My interface method look…
R Besar
  • 574
  • 1
  • 5
  • 12
17
votes
2 answers

Setting encoding for a Multipart Entity

I want to set a UTF-8 Encoding to a MultipartEntity object or to StringBody object. Is there any way to do it? I know how to set the Charset but not the Encoding. Thank you.
Alex
  • 6,957
  • 12
  • 42
  • 48
13
votes
5 answers

Is it possible to have a nested MultipartEntities or FormBodyPart in a multipart POST?

I'm trying to make something the following server POST request using MultipartEntity: parameters: {"parameter1"=>"parameter1", "parameter2"=>{"sub_parameter1"=>"sub_parameter1", "sub_parameter2"=>"sub_parameter2"}} I am currently using something…
Collin Buchan
  • 257
  • 1
  • 3
  • 9
13
votes
3 answers

Library and examples of parsing multipart/form-data from inputstream

The response to one kind of HTTP request I send is a multipart/form-data looks something like: --------boundary123 Content-Disposition: form-data; name="json" Content-Type: application/json {"some":"json"} --------boundary123 Content-Disposition:…
Linus
  • 3,254
  • 4
  • 22
  • 36
12
votes
3 answers

Android : upload Image and JSON using MultiPartEntityBuilder

I try to upload data to server, my data containing multiple images and large JSON, before it, I Try to send with convert image to string using base64 and send my another data and image that I've convert before with JSON, but I face Problem…
Menma
  • 799
  • 1
  • 9
  • 35
12
votes
2 answers

How can I print/log entire body contents of MultiPartEntity that is being used by HTTPRequest?

I want to verify what exactly is in HTTP request i.e Parameters and Headers. The code, which I am debugging uses MultiPartEntity to setEntity before making executing HTTP Request. response = executePost(multipartEntity); statusCode =…
suhas_sm
  • 2,064
  • 1
  • 18
  • 23
12
votes
3 answers

Android error : MultipartEntity , request sent by the client was syntactically incorrect

I am suppose to send song (mp3/wav) file and some data through secure restful web service. I am using MultipartEntity to make HttpPost request. but When I execute it through HttpClient, the server replies this error HTTP Status 400 - Bad…
Azhar
  • 20,500
  • 38
  • 146
  • 211
10
votes
0 answers

change length of each burst in multipart file upload in android

Is there some way to limit the parts size that are sent on a MultipartEntity from the org.apache.http.entity.mime.MultipartEntity . I am using volley for network requests. I have tried extending the Volley request class and overriding the getbody()…
chaitanyad
  • 998
  • 1
  • 9
  • 27
9
votes
1 answer

Can HTTP multipart and chunking coexist?

I'm using apache HttpClient to post several files to server. Here's the code: public static HttpResponse stringResponsePost(String urlString, String content, byte[] image, HttpContext localContext, HttpClient httpclient) throws Exception…
Mehdi
  • 1,075
  • 1
  • 11
  • 24
7
votes
2 answers

UTF-8 encoding with FileBody in MultipartEntity

I want to set UTF-8 encoding while files sending in FileBody as I do it in a StringBuilder. I do it like this: restClient.AddEntity("body", new StringBody(body, Charset.forName("UTF-8"))); and it works properly if I send different from UTF-8…
Rikki Tikki Tavi
  • 3,089
  • 5
  • 43
  • 81
6
votes
4 answers

Android post image to the Server using MultipartEntity

I have been trying to upload an image and data to Django server. I have included apache-mime4j.0.6.jar and httpmime4.0.1.jar libraries ( Project->build path->Add external jar files) And here's the code to upload an image. HttpResponse response =…
Geetanjali
  • 101
  • 1
  • 1
  • 5
5
votes
2 answers

Bitmap to MultiPartEntity using retrofit

Before i will start i see a lot of questions about this but nothing works for me maybe someone can explained or display it to me how can compress bitmap to MultiPart entity and than send it to the server correct using Retrofit
moshe kobi
  • 71
  • 1
  • 7
5
votes
2 answers

No static field INSTANCE of type Lorg/apache/http/message/BasicHeaderValueFormatter

I get the following error: Process: com.project.publiko, PID: 27061 java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/message/BasicHeaderValueFormatter; in class Lorg/apache/http/message/BasicHeaderValueFormatter; or its…
5
votes
1 answer

Trouble Sending Multipart File with Boundary via Volley

I have a customers HTTP call working using the standard apache classes but I am trying to create a custom Volley class to handle this. Here is the code for standard call: HttpURLConnection conn = (HttpURLConnection) new…
JPM
  • 9,077
  • 13
  • 78
  • 137
1
2 3
15 16