commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thusitha Thilina Dayaratne <thusithathil...@gmail.com>
Subject Re: How to Access File Streams Later
Date Tue, 31 May 2016 01:31:42 GMT
Hi Li Ying,

Thanks for the response. Yeah I agree with you I can save a temp file and
then create new set of stream. But when it comes to large files it will
take much time since first I've to save the file and then send it to the
actual service.
Therefore I was thinking of not to process the stream but just passing that
to the service.

Thanks

2016-05-31 5:54 GMT+05:30 Li Ying <liying.cn.2010@gmail.com>:

> Hi Thusitha
>
> Maybe you need save the upload-file stream into a temporary file on your
> server. And then, you can access the file content from the temporary file
>
> 2016-05-30 14:43 GMT+09:00 Thusitha Thilina Dayaratne <
> thusithathilina@gmail.com>:
>
> > 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