开发者

Stream File in Portlet with Java

I'm quite new to Java. I am trying to make a Vaadin portlet and I need to basically allow the user to download a file. The file is accessible through a GET request that requires Basic Authentication (username and password). The user can see these credentials as they will be theirs.

I realize I can download the file to the server hosting the portlet and then make it available. But some of these files are large (some over 500 mb). Is it possible to handle the incoming file (without saving it to the server) and hand it off to the user?

Any recommendations or suggestions would really help, my only re开发者_开发知识库al experience with this was saving a file to the local machine (a csv in this case) and then having the user download that.

Thanks!


You may not want to store the entire content of the file to be served in memory. How about saving it in database and then streaming it off of there!!! You can write the InputStream obtained to the database using PreparedStatement#setBinaryStream Also, please take a look at Apache FileUpload

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜