multipart

Returning both image and JSON in multipart response with Jersey

牧云@^-^@ 提交于 2019-12-24 15:46:10
问题 I'm learning Jersey by trying to create a Rest service that receives an image from client, processes the image and returns a new image with additional information (i.e., about processing details). So far, the uploading works fine. I'm now concerned with creating the response. I'm thinking of creating a multipart response that contains the new image in 1 bodypart while adding a JSON string (that contains the additional info) into another body part. However I wasn't successful. The code is as

Not able to upload 2gb size file with struts 2.0 frmework

て烟熏妆下的殇ゞ 提交于 2019-12-24 12:25:27
问题 Now days all latest browser, support 2 gb size limit for file upload process, Right now we are using following in our application Java, JSP, Struts 2.0 framework , we did not able to upload 2gb size file, so i have search in net, i am able to find struts.multipart.maxSize property configuration in struts.xml , i have set this value up to 2gb size, i have also set maxPostSize size property in tomcat server.xml file for increase postdata size with request. Still we did not able to upload 2gb

How to send multipart binary sms in Android?

岁酱吖の 提交于 2019-12-24 04:58:12
问题 I'm trying to send a binary sms in Android. But when the size of the message exceeds one sms, I get different errors depending on the device. I saw there is a method to send multi-part text sms, but not for sending multi part binary sms. So, what I have to do? 回答1: It seems that there's really no way to do this. I've found someone that asked this same thing on Android Developer list two years ago and received no answers until now. Unfortunately, I'm not finding the post right now, but there

Using multiple values for the same param in a multipart's PartMap request with Retrofit 2

依然范特西╮ 提交于 2019-12-24 02:25:34
问题 I want to send multiple values of the same param in a multipart query. Here is my code: Interface: @Multipart @POST("user") Observable<Void> updateUser(@PartMap() Map<String, RequestBody> partMap, @Part MultipartBody.Part photo); This request allow me to update a user with a new picture and some parameters. In the parameters I can specify the user's skills with a parameter named "skills[]". To specify the parameters that can vary in number I use a HashMap; however with a HashMap I cannot

How to post an image to server in android

放肆的年华 提交于 2019-12-24 00:40:43
问题 How do I upload an image to the Server? Both MultiPArtEntity and MultiPartEntityBuilder classes are deprecated in API level 23. Can we do this using HTTPUrlConnection or volley? 回答1: I suggest that you use OkHttp. More details about it you can find at the following: OkHttp - An HTTP & SPDY client for Android and Java applications Please refer to my basic sample code that uploads a PNG file from drawable folder to remote web service. Hope this helps! ... mTextView = (TextView) findViewById(R

Read request payload in Go?

杀马特。学长 韩版系。学妹 提交于 2019-12-24 00:37:46
问题 I'm using a file uploader and need details from the request payload to crop it. func Upload(w http.ResponseWriter, r *http.Request) { reader, err := r.MultipartReader() if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } //copy each part to destination. for { part, err := reader.NextPart() if err == io.EOF { break } if part.FormName() == "avatar_data"{ // Read the content in "avatar_data" how? } if part.FileName() == "" { continue } dst, err := os.Create("

FileNotFoundException while uploading image using Retrofit

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 17:56:36
问题 I tried to upload an image using Retrofit but I am getting this error: Unable to submit post to API: java.io.FileNotFoundException: /document/image:30231: open failed: ENOENT (No such file or directory) My interface is like this: public interface MyService{ @Multipart @POST("/url") Call<ResponseBody> addNewEvent( @Part("case_Id") int caseId,@Part MultipartBody.Part(file); } On Button click, selectImage() function is called: private void selectImage() { Intent intent = new Intent(); intent

php submitting multipart and xml together to web service

夙愿已清 提交于 2019-12-23 05:36:06
问题 I need to submit an XML and an image together to a restful web service. Is this possible using curl ? Of the various examples available in web, I could see that they are passing a multipart and other form data together. But, I could not locate an example which sends an XML and an image together. Here is the code I am trying. <?php $url = "http://www.myservice.com/event"; $file = dirname(__FILE__) . "\image.jpg"; $boundary = "---------------------".substr(md5(rand(0,32000)), 0, 10); $event_xml

How to pass multipart/related request in Mule?

[亡魂溺海] 提交于 2019-12-23 04:35:20
问题 I want to request an API using Mule.It is using Multipart/related Content-Type to upload a file.I Don't know how to pass the boundary information in mule.How to set the given input in a payload to send to HTTP.I tried to put it in a transform Message component but it showing errors. 回答1: You can use the outbound attachments collection to create the form parts as necessary, and don't need to specify the boundary. For example, consider the following Mule configuration: <scripting:component doc

jersey 2 multipart pojo is always null

送分小仙女□ 提交于 2019-12-23 03:56:07
问题 I'm trying to write a rest service to upload a file along with some other file information, using Jersey + Jackson. Using multipart, the file is uploaded correctly, and simple fields are OK as well, but the POJO that's supposed to contain additional data, is always null. Simplified example POJO: public class Test { public String name; public Test() {} public String getName() { return name; } public void setName(String name) { this.name = name; } } Application: @ApplicationPath("myapp") public