Comma Separated Values (CSV) Providers
Apache Wink provides a CSV data model and providers for producing and consuming CSV (text/csv). The model is based on a Serialization and a Deserialization interface, in addition to a simple CSV Table class. All of the model classes are located under the com.hp.symphony.common.model.csv package.
The following tables list the providers that provide this functionality.
|
Supported |
Media Types |
Data Model |
Provider registration |
---|---|---|---|---|
Read |
Yes |
text/csv |
org.apache.wink.common.model.csv.CsvDeserializer, |
Not required. Registered by default |
Write |
Yes |
text/csv |
org.apache.wink.common.model.csv.CsvSerializer, |
Not required. Registered by default |
Examples
TBD
Producing CSV
TBD
@GET @Produces("text/csv") public CsvTable getJohns() { CsvTable cvs = new CsvTable("Id", "First Name", "Last Name", "Email"); cvs.addRow("1","John","Kennedy","john@Kennedy.org"); cvs.addRow("2","John","Lennon","john@Lennon.org"); cvs.addRow("3","John","Malkovich","john@malkovich.org"); cvs.addRow("4","John","McCain","john@McCain.org"); return cvs; }
Consuming CSV
TBD
@POST @Consumes("text/csv") public void postCsv(CsvTable csv) { for (String[] row : csv.getRows()) { for(String cell: row){ System.out.print(cell + " ,"); } System.out.print("\n"); } }
Explanation
TBD