开发者

Servlet 3.0 streaming api for file upload

New Servlet 3.0 API provide us with convenient way to parse multi-part form da开发者_开发知识库ta. But it stores content of uploaded files in file system or in memory

Is there streaming API for Servlet 3.0 ?

Something like Commons FileUpload. I have to write content directly from InputStream and write to another OutputStream adn I don't want to store temporary file content in disc or memory


I used this once for something similar, though not with servlets. It doesn't fill up your memory with data. Hope it helps: http://code.google.com/p/io-tools/wiki/Tutorial_EasyStream


Looking at the Servlet 3.0 spec it may not be possible to have a streaming implementation

For parts with form-data as the Content-Disposition, but without a filename, the string value of the part will also be available via the getParameter /getParameterValues methods on HttpServletRequest, using the name of the part.

So the request must be parsed up front so that all the non-file parts can be exposed as HttpServletRequest parameters.

You have to use third party libraries if you need streaming.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜