[2.3.0 Java] How to serve file download with resume capability in Play Framework 2?

104 views
Skip to first unread message

Saeed Zarinfam

unread,
Jun 11, 2014, 6:01:05 AM6/11/14
to play-fr...@googlegroups.com

How to serve file download with resume capability in Play Framework 2?

I had used this route:

GET         /assets/*file           controllers.Assets.at(path="/public", file)

and this action:

public static Result downloadFile(String filePath) {
    File file = new File("public/files/"+filePath);
    return ok(file);
}

But they did not work.

Megazord

unread,
Jun 11, 2014, 10:26:52 AM6/11/14
to play-fr...@googlegroups.com
I don't think play provides resumable downloads out of the box, but it is probably easy to implement it by yourself. Take a look here to see which HTTP headers you should use:

http://benramsey.com/blog/2008/05/206-partial-content-and-range-requests/

HTH
Reply all
Reply to author
Forward
0 new messages