FasterXML / FasterXML/jackson-dataformats-text

Async (non-blocking) support for CSV

Offen
#287 8 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
csv
Vorherrschende Sprache
Java
Sterne
455
Forks
164
Ø Merge
6 T. 10 Std.
Gemergte PRs (30 T.)
2

Beschreibung

This question relates to usage of Jackson DataFormats CSV within Spring WebFlux.

I have a REST controller (Spring WebFlux) which returns a Flux from a Stream of a simple bean (MapInfo). The endpoint serves application/json (only for demo) and application/x-ndjson (for large datasets). I'd like to add support for text/csv also.

```
@GetMapping(produces = { "application/json", "application/x-ndjson", "text/csv" })
public Flux mapInfo() {
return Flux.fromStream(mapInfoStream());
}
```

Invoking this for text/csv results in HTTP 500 with message:
`"No Encoder for [com.mizuho.fo.dataservices.hc.controller.MapInfoController$MapInfo] with preset Content-Type 'null'"`

**I have not yet added any Jackson Dataformat libraries so this is expected.**

Question: Does Jackson Dataformat CSV have the necessary non-blocking support in order for it to be used to convert the payload to CSV?

Of course I could be imperative and write code to format as CSV, returning a Flux of String for instance, but my hope is to effect CSV output without lowering the abstraction level beyond what is already there (returning a Flux from a Stream of the POJO).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.