This is the java code to upload a json file via HTTP Post. I am using for that the HttpClient from Apache.
byte[] data = outStream.toByteArray() HttpClient client = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://localhost:8080/YourResource"); ByteArrayBody byteArrayBody = new ByteArrayBody(data, "application/json", "some.json"); MultipartEntity multipartEntity = new MultipartEntity(); multipartEntity.addPart("upload", byteArrayBody); httpPost.setEntity( multipartEntity ); HttpResponse response = client.execute(httpPost); Reader reader = new InputStreamReader(response.getEntity().getContent());