Would it be possible to accept csv types? service.path(appPath).accept(mediaType).get(String.class)
There's no MediaType.TEXT_CSV defined in javax.ws.rs.core.MediaType. Have I missed something?
I am currently on Jersey 1.1.6.
Many thanks.
You could define your own media type:
public final static String TEXT_CSV = "text/csv";
public final static MediaType TEXT_CSV_TYPE = new MediaType("text", "csv");
csv is nothing but comma seperated text file
you can always use text\plain
as media type to deal with CSV files - and deal with the CSV using frameworks such as Open CSV.
Or (in case of fileupload)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public String process(@FormDataParam("file") InputStream csv) throws IOException {
//Process CSV file
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With