AFAIK it is NOT possible to have a lazy list populated on demand, because we cannot know the number of attachments in the HTTP body till we parse the body. The iterator (FileItemIterator) is the only working approach - you ask for the next attachment and you parse input stream further till you face one.
> On 11 Jul 2023, at 13:02, Romain Manni-Bucau <rmannibu...@gmail.com> wrote: > > This is a good point but guess it is not hard - and would be great - to fix > it in tomcat, just needs to not use ArrayList but a lazy list which will > behave like fileupload streaming API. Under the hood the API already uses > the FileItemIterator , it just needs to be able to populate the list lazily. > > Romain Manni-Bucau > @rmannibucau > <https://www.google.com/url?q=https://twitter.com/rmannibucau&source=gmail-imap&ust=1689678203000000&usg=AOvVaw3qqT1RRsU7FfGEjH71MpYD> > | Blog > <https://www.google.com/url?q=https://rmannibucau.metawerx.net/&source=gmail-imap&ust=1689678203000000&usg=AOvVaw2mrk6QnasITfnU8GRENCTc> > | Old Blog > <https://www.google.com/url?q=http://rmannibucau.wordpress.com&source=gmail-imap&ust=1689678203000000&usg=AOvVaw2Ngwvevye-Ks7lkKfus6-S> > | Github > <https://www.google.com/url?q=https://github.com/rmannibucau&source=gmail-imap&ust=1689678203000000&usg=AOvVaw0v9iQacoZYhsaDAtt9YYzt> > | > LinkedIn > <https://www.google.com/url?q=https://www.linkedin.com/in/rmannibucau&source=gmail-imap&ust=1689678203000000&usg=AOvVaw2xTNsW2b2LNDCRolnR98VV> > | Book > <https://www.google.com/url?q=https://www.packtpub.com/application-development/java-ee-8-high-performance&source=gmail-imap&ust=1689678203000000&usg=AOvVaw3zcwUb9o-Bj6YM_TFj0eeo> > > > Le mar. 11 juil. 2023 à 12:57, Eugene Grybinnyk > <euge...@backbase.com.invalid> a écrit : > >> We tried to get rid of commons-fileupload in favour of Servlet API for our >> project where we disable multipart and use streaming (not to store files on >> the disk). And it looks like Servlet API doesn’t provide a convenient way >> of streaming the attachments (like commons-fileupload does) so in the end >> we concluded that we need to implement something similar to what we get >> from commons-fileupload OR to wait for version commons-fileupload:2.0. >> >> On 2023/07/09 14:45:21 Emmanuel Bourg wrote: >>> Dumb question: what's the benefit of using commons-fileupload in 2023 >>> instead of the equivalent file upload feature of the Servlet API? >>> >>> The use case I had in mind was to support file upload in very old >>> Servlet containers still in production (Tomcat 6 or Jetty 7 for example, >>> both EOL), but servers supporting the Jakarta API are recent and have >>> the file upload feature integrated. I'd expect commons-fileupload to go >>> to dormant in the near future rather than adapted for the jakarta >> namespace. >>> >>> What did I miss? >>> >>> Emmanuel Bourg >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org >>> For additional commands, e-mail: dev-h...@commons.apache.org >>> >>> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org