commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thusitha Thilina Dayaratne <thusithathil...@gmail.com>
Subject How to Access File Streams Later
Date Mon, 30 May 2016 05:43:10 GMT
Hi All,

I'm trying to use apache commons-fileupload to support file streaming with
my own rest framework. I get a multipart/form-data request from the client
side and want to the file as as stream to the backend.

FileItemIterator iter = upload.getItemIterator(request);
> while (iter.hasNext()) {
>       FileItemStream item = iter.next();
>       // Add objects to a map (I don't want to process the stream here.
> Just pass)
> ..... // If I access the stream here no errors and everything ok
> }


But in the backend side when I'm trying to access the stream I'm getting
ItemSkippedException
AFAIU it seems that hasNext() method closes the stream. Therefore I have to
consume the stream before calling next hasNext().
But I just want to access as a proxy and consume the stream later. Is there
a possible way for me to consume the stream later ?

-- 
Thanks
Thusitha

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message