Le mer. 12 juil. 2023 à 17:53, Christopher Schultz < ch...@christopherschultz.net> a écrit :
> Romain, > > On 7/11/23 08:57, Romain Manni-Bucau wrote: > > on commons fileupload list there was the need to have streaming for > Parts. > > > > As of today Servlet API enables to only get a list and not an iterator - > > even if it uses it under the hood. > > :/ > > It's a Collection, though, and not a List, so there is a little more > flexibility. > > > Any way tomcat pushes that need (Iterator or Stream I guess) to the > servlet > > EG for next version? > > We could certainly propose it. Something like > > Iterator HttpServletRequest.getPartIterator() > and/or > Stream HttpServletRequst.getPartStream() > > > Do we want to provide this thru the current API implementing a LazyList > > (while only Iterator is touched the list is not materialized)? > > If implemented as a LazyList, then getParts().iterator() will get you > what you want and the Servlet API need not be modified. On the other > hand, supporting such streaming interfaces better-communicates the > application's intent to consume the parts in a streaming fashion rather > than all-at-once. > > But it may delay IO errors until after getParts() is called. How would > we handle that? With some kind of RuntimeException thrown from > Collection, Iterator, and Stream operations? > Yes, an IllegalStateException from Iterator implementation sounds sufficient (stream being an iterator wrapper thanks StreamSupport class). > > -chris > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >