Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.7DR#1
-
Fix Version/s: 1.8.2-EE-GA_P01, 1.8.3
-
Component/s: ICE-Components
-
Labels:None
-
Environment:All
-
ICEsoft Forum Reference:
Description
Users would prefer to have access to a stream for saving the uploaded file directly into a database, instead of to the filesystem.
The way that the commons upload code works, is that we receive the file in chunks, and probably wouldn't want to expose those intricacies to the application layer. So if the application could provide the ice:inputFile component an OutputStream with which to write to, then that would be the simplest approach.
The way that the commons upload code works, is that we receive the file in chunks, and probably wouldn't want to expose those intricacies to the application layer. So if the application could provide the ice:inputFile component an OutputStream with which to write to, then that would be the simplest approach.
Compared various methods of providing file information, while skipping the filesystem:
1. Writing to a byte[], which could then be set in the FileInfo structure, for the application to pickup in the actionListener. The main problem with this approach is the potentially large memory overhead on a user by user basis, which could easily blow the heap if there is a noticeable load of uploaders, particularly because of how the byte[] would have to be growable, and so the max memory usage could be several times larger than the number of users * max quota.
2. The InputStream to the socket data is passed on to the application, so it can read it. This is fraught with too many things that could go wrong. First off, the reading of that InputStream is what pushes the progress notification system, which makes the lifecycles happen. But the application would have to be given the InputStream within a lifecycle, leading to the likelihood of nested lifecycles, or a much more complicated usage model. Also, the ending lifecycle, that causes the iframe result to be sent, has to be done in a timely manner. Putting this under application control increases the likelihood of this not being done when it has to be.
3. The application provides an OutputStream, which could be a ByteArrayOutputStream, or one for a database BLOB/CLOB, or whatever it needs, to the InputFile component, via a ValueBinding attribute on the InputFile. The UploadServer would need to do an initial lifecycle to access this OutputStream, with progress=0. The existence of the OutputStream could be indicated, and accessed via the existing UploadConfig mechanism. Once the UploadServer has it, it would simply substitute that application OutputStream in place of whatever FileOutputStream it would have otherwise created. The quota mechanism would have to be rethought, since this currently relies on checking the written file size. Hopefully something could be done to not have actually written more than the quota to the application OutputStream or FileOutputStream, since that seems like a flaw in the quota that once can temporarily write more than the acceptable amount.