I did post this same question at LightBend's discussion group here, but cannot get an answer that solves my issue. Since I am really anxious to know what is the problem here, let me again post this question here, hoping a big audience group might mean a better chance of getting an answer.
So basically, at this page, https://developer.lightbend.com/start/?group=play, we can find a list of example Play! projects. Among these examples, there is one project is about Java File Upload (https://developer.lightbend.com/start/?group=play&project=play-samples-play-java-fileupload-example). This project teaches the readers how to create a file uploader using Akka Streaming idea, therefore even when the file is large, we can still safely upload it without reading it as a whole into the memory.
This project works for small files, but when I try to upload a larger file, for example, which has a size about 15M, I will get a page says “The connection was reset”.
Now, in this example project, inside application.conf
file, I see this,
# **Sets the maximum file size that can be uploaded to 1024k.**
# https://www.playframework.com/documentation/2.8.x/JavaBodyParsers#Content-length-limits
play.http.parser.maxMemoryBuffer=1024k
Indeed - if I upload any file that is smaller than 1024k, it will work, but anything larger than that, it will not work.
Now, I am very confused. Notice 1024k is the size of maxMemoryBuffer
! This does not make sense to me because the whole idea of “streaming it”, is to be able to stream it with a much smaller memory buffer and without reading the whole file into the memory first. But the file size has to be smaller than play.http.parser.maxMemoryBuffer
??? this makes me think it might just read the whole file into memory …
I know I am wrong, but just don't know where I am wrong and what I have missed. I hope someone with a better idea can see this question and will kindly let me know what is happening… Thank you so much for the help!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…