|
I believe you are referring to DiskFileItem not being serialisable. I don't see
a way to fix this, as you say, because of the nature of the class. Note that it is the FileItem interface that is serialisable, but this particular implementation of that interface cannot be serialised. That doesn't mean that all implementations will not be serialisable. As for comment #1, the simple solution is to not store FileItem instances in If anyone has any good ideas on how to make DiskFileItem serialisable, please Created an attachment (id=17057)
Patch to make DiskFileItem Serializable I'm attaching a patch that makes DiskFileItem serializable. It works by making I also included a slight change to ensure cachedData is always used if exists. Created an attachment (id=17058)
Serialization JUnit test for DiskFileItem Unfortunately, this will almost certainly cause OutOfMemory exceptions when
large uploads are involved. This is because both writeObject and readObject rely on the entire contents being loaded into memory. That's fine for typical form fields, but if the item represents a 2GB upload, things don't look so good. Something along these lines that streams the content from or to a DFOS might Created an attachment (id=17059)
Modified patch for DiskFileItem OK, how about copying the disk file to a new file during de-serialization That'll work. Thanks! Patch applied, with a simplification to readObject() and
some other minor changes. Created an attachment (id=17060)
3rd Patch for DiskFileItem I guess the 2nd patch isn't a great idea either since its not v.efficient Attaching a 3rd patch - if its not "in memory" this one caches the File that |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
thing that makes my webapp sessions non-serializable.