I have the following requirement:

A user fills out a form (similar to email composition) and is allowed to upload a certain number of potentially large files. Since the form may have errors its successful competition may happen after several submits (posts) which make up a single "conversation".


I've found two problems while using tapestry-upload in such a scenario (conversation mode):

1) UploadedFiles are forcefully deleted on thread cleanup so it is not possible to keep uploaded files around for the duration of the "conversation". -> Is it possible abstract this behaveour in a cleanup strategy and have another one that cleans up differenty (either at end of conversation, or it leaves it to the FileCleaner - which does it after the FileItem object is garbage collected)?

2) UploadedFile / UploadedFileItem are not serializable - thus they cannot go into a session.

Do you think tapestry-upload should support "conversational" uploads?


In the meanwhile, I'm trying to work this around:

The idea is that a service (UploadManager) keeps track of UploadConversation. one UploadConversation is associated with a single upload attempt (multiple files across potentially multiple POSTs). The UploadConversation stores all uploaded files on temporary file locations and makes them all available for "processing" when the "session" ends.

Ideally I would keep the UploadedConversation @Persist("session") (-ed) throughout the conversation. When the form is submitted successfully, I'd just discard persisted data using ComponentResources.

But since I'm building this as a library functionality I'd like to add some safety measures - I'd like to delete the tracked files associated with one UploadConversation. So

1) is there a way to find out when an object that was @Persist("session") -ed is no longer in use (apart from finalize() / PhantomReference)

2) if no, is there an easy way to find out when a http session gets discarded/invalidated?



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to