Sylvain Wallez wrote:
Ugo Cei wrote:
Sylvain Wallez wrote:
A solution is to keep the uploaded content in a temp area until the form is valid. But what if the user leaves and never re-submits the form? Should we rely on the garbage collector to finalize() the upload widget to clean the temp area?
How about catching the expiration of the continuation and removing the temp file from there?
Good idea.
For this, we'll need some kind of "ContinuationExpirationListener". But
Maybe you can use the ContinuationsDisposer for this?
I added this during the making of 'Apples' to dispose resources (looked up components) your Apple might be holding
Yep, I remember that ;-)
they'll have to be registered in the continuation that _will_ be created at the next sendPageAndWait, as the latest continuation represents a past state, and may not exist if we just started the flowscript.
Hm, of course for apples it was slightly different, since there the use-case controller is one object-instance (and not multiple ones)
but maybe we can find a way to register this kind of clean-up stuff on the level of the complete use-case... or in flowscript lingo on the level of the continuations-tree (so it only gets executed if the last node in the tree is expired, and not upon clearing each node)
I don't think this is enough: as explained above, the objects to be disposed should be attached to the continuation that _will_ be created (they belong to this future state) and not to the latest one (which may not exist if we just started the flow function). And they must be disposed immediately in case of a sendPage() (no continuation created).
In its current first incarnation (will be committed after 2.1.3 is out), the upload widget relies on finalize() to cleanup temp files.
Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } Orixo, the opensource XML business alliance - http://www.orixo.com
