Search code examples
scalatra

How can I send a file to the browser using Scalatra?


I'm using the scalatra-sbt-prototype. What would I have to modify, and where , to be able to serve files from a directory on my filesystem? Say for example , I would want to serve the file first.tar.gz from /home/downloads/first.tar.gz, and have it accessible as:

http://localhost:8080/first.tar.gz

Solution

  • Returning a java.io.File to the browser, from an action, seems to accomplish this.