Created
May 4, 2016 20:45
-
-
Save retrospectacus/3c8a4c67debc8dced989752e2d38adc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val content = StreamConverters.asOutputStream().mapMaterializedValue { os => | |
writeXlsDataToStream(os) | |
os.close() | |
} | |
Ok.chunked(content).as("application/xls").withHeaders( | |
"Mime-Type" -> "application/xls", | |
"Content-disposition" -> s"attachment; filename=Report${DateTimeFormat.forPattern("_ddMMMYYYY_HHmmss").print(new DateTime)}.xls" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val content = Source.fromPublisher(Streams.enumeratorToPublisher(Enumerator.outputStream { os => | |
writeXlsDataToStream(os) | |
os.close() | |
} >>> Enumerator.eof)) | |
Ok.chunked(content).as("application/xls").withHeaders( | |
"Mime-Type" -> "application/xls", | |
"Content-disposition" -> s"attachment; filename=Report${DateTimeFormat.forPattern("_ddMMMYYYY_HHmmss").print(new DateTime)}.xls" | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment