I need to create a large tab separated file as a response to HTTP GET request.
In my route a create some Scala objects and then I want to write some custom representation of those objects to the Output Stream.
It is not just serialization to tab separated instead of JSON, because I need also to create a header with column names, so IMHO this can't be solved with custom marshaling.
So how can I get a writer or outputstream from HttpRequest?
Something like
~path("export") {
get {
val sampleExonRPKMs = exonRPKMService.getRPKMs(samples)
val writer = HttpResponse().getWriter // this does not exists
writeHeader(writer)
... // write objects tab separated
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…