I need to get an HTTP Post Multipart that contains only 2 parameters:
What is the right way to establish a body? I am going to test an HTTP call using the Chrome REST console, so I wonder if the correct solution is to set a βlabelβ for the JSON parameter and the binary.
On the server side, I'm using Resteasy 2.x, and I'm going to read the Multipart body as follows:
@POST @Consumes("multipart/form-data") public String postWithPhoto(MultipartFormDataInput multiPart) { Map <String, List<InputPart>> params = multiPart.getFormDataMap(); String myJson = params.get("myJsonName").get(0).getBodyAsString(); InputPart imagePart = params.get("photo").get(0);
Is that the way? Is it right to get my JSON string using the "myJsonName" key, which identifies the specific content? Is there any other way to get these 2 content in one HTTP request?
Thank you in advance
thermz Jan 31 '12 at 14:20 2012-01-31 14:20
source share