Hi All,
Does anyone have a sample jersey client for the equivalent
"cURL -T fileName.csv -H Content-Type:text/csv
http://localhost:8080/handleCSVs"
So far I tried, that didn't work:
1.
MultiPart multiPart = new MultiPart();
FileDataBodyPart fileDataBodyPart = new FileDataBodyPart(nameOfFile,
new File(nameOfFile));
multiPart.bodyPart(fileDataBodyPart);
ClientResponse response =
webResource
.type("text/csv")
.post(ClientResponse.class, multiPart);
System.out.println("Status:" + response.getClientResponseStatus());
2.
String content = ... // read entire file into a String
ClientResponse cfResponse =
webResource
.type(MediaType.TEXT_PLAIN_TYPE)
.post(ClientResponse.class, content);
System.out.println("Status:" + response.getClientResponseStatus());
Thanks, in advance.
Sree