How to pipe the file input stream to response output stream in scalatra .
45 views
Skip to first unread message
Mahendar Goud
unread,
Jan 6, 2020, 7:33:56 AM1/6/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to scalatra-user
Hi All,
I have api endpoint called download which need to download a zip file when you hit the api . currently I am reading the files using the file input stream and writing with zipoutput stream to temp location .Now I need to pipe the file input stream to response stream in scalatra.
Currently Iam using
Scalatra 2.6
Thanks
J Mahendar
Naoki Takezoe
unread,
Jan 8, 2020, 8:42:09 AM1/8/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
Thus, simply returning InputStream from your controller should work.
Also, you can return File directly instead of InputStream.
By the way, we have an online chat room on Gitter.
There are some more active users and developers.
It might be better to ask there if you have any questions.
https://gitter.im/scalatra/scalatra