The example below is not using mutlipart. To post a file and receive
JSON do:
File f = ...
WebResource r = ...
JSONObject jo = r.accept("application/json").type("text/
csv").post(JSONObject.class, f);
Paul.
On Jan 20, 2011, at 11:49 PM, sree_at_work_at_yahoo.com wrote:
> Hi,
>
> I am able to do it using Apache HttpComponents.
> Here is the code:
>
> HttpPost httpPost = new HttpPost(RESTful URL);
> httpPost.addHeader("Content-Type", "text/csv");
>
> FileEntity fileEntity = new FileEntity(new File(fileName), "text/
> csv");
> httpPost.setEntity(fileEntity);
>
> HttpClient httpClient = new DefaultHttpClient();
> HttpResponse httpResponse = httpClient.execute(httpPost);
>
> httpResponse.getStatusLine();
>
> JSONObject json = new JSONObject(EntityUtils.toString(httpEntity));
>
> I can switch back to Jersey in my project,
> provided the above scenario can be made working using Jersey.
>
> Looking forward for your help.
>
> Thanking you,
>
> With Regards
> Sree