public class FileController extends Controller {
/**
* download
* @param f filename
* @return Result
* @throws FileNotFoundException
*/
public Result download(String f) throws FileNotFoundException {
final InputStream is = new BufferedInputStream(new FileInputStream(f));
return ok(is).withHeader("Content-Disposition", "attachment; filename=1.txt");
}
}
routes file
GET /api/files ytd.pdnms.controllers.FileController.download(f: String)
-> / com.lightbend.lagom.javadsl.server.LagomServiceRouter