I want to upload a file from jsp, handle it in my servlet and then pass the same file as Restful webservices from servlet.
Html:
<html>
<body>
    <h1>Upload File with RESTFul WebService</h1>
    <form action="rest/fileupload" method="post" enctype="multipart/form-data">
       <p>
        Choose a file : <input type="file" name="file" />
       </p>
       <input type="submit" value="Upload" />
    </form>
</body>
</html>
Servlet:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
FileBody fileContent= new FileBody(new File(fileName));
StringBody comment = new StringBody("Filename: " + fileName);
MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("file", fileContent);
httppost.setEntity(reqEntity);
HttpResponse response = httpclient.execute(httppost);
HttpEntity resEntity = response.getEntity();
But here, when I get the file from jsp in my own servlet, I will only get it as FileItem due to Multipart Form Data. Now how can I place that FileItem inside FileBody in order to send it as MultipartEntity. Please note that I would not want to call the Webservices directly from jsp page.
