Reputation: 10030
I coulnd't find any indication in Spring documentation that it support read of files in streaming mode in its object MultipartHttpServletRequest that handle multipart requests.
in similar way that is possible in Apache Commons framework.
is it supported in Spring at all?
Upvotes: 3
Views: 5020
Reputation: 8969
Yes, have a look here. Your Spring API is far too old. Also, the Streaming mode has nothing to do with Spring. It is the ability of your servlet container or your server. Most server now support the streaming mode. Servlet will start performing the request as soon as it got the header from your request. You can continue to send out the stream of your request body (e.g. multipart data). However, the parsing can only be performed completely when the request is sent fully. This is the same as Apache Common FileUpload.
Alternatively, you can write a controller using Spring annotation. Spring will inject the ServletRequest if you add that as one of your method controller arugument. After that, you can use Apache FileUpload to do multipart parsing.
You can not do selective parsing since the request must be fully sent to server no matter what. It is the limit of Http. I asked the question a few day ago.
Upvotes: 1