commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mfncoo...@gmail.com>
Subject Re: [fileupload] Re: Using parseRequest(request) more than once
Date Sun, 03 Apr 2005 00:24:49 GMT
On Apr 2, 2005 4:17 PM, Navid Mehregani <navid89@yahoo.com> wrote:
> It's not as easy as that.  I'm modifying an existing
> code and your suggestion wouldn't be feasible in my
> case.

Well it's not possible to read the servlet input stream more than
once, because after it's been read, it's gone. So there's no viable
alternative, I'm afraid.

--
Martin Cooper


> Navid
> 
> 
> --- Martin Cooper <mfncooper@gmail.com> wrote:
> > First of all, please follow the conventions of the
> > mailing list and
> > prepend the name of the relevant component to the
> > subject line, in
> > square brackets. That way, people know at a glance
> > which component
> > your question is about.
> >
> > On Apr 2, 2005 12:00 PM, Navid Mehregani
> > <navid89@yahoo.com> wrote:
> > > I have a HttpServletRequest object that's
> > multipart
> > > content (i.e
> > FileUpload.isMultipartContent(request) ==
> > > true).
> > >
> > > I have to read the parameters of this request
> > object
> > > in several different functions.
> >
> > Why? I mean, why do you need to *read* them in
> > several different
> > functions? Why can't you read them once and then
> > pass them around?
> >
> > That's actually what you're going to have to do.
> > Once you've called
> > parseRequest(), the request input stream has been
> > consumed, and cannot
> > be read again. This is not something that FileUpload
> > can do anything
> > about - it's just how streams work.
> >
> > --
> > Martin Cooper
> >
> > > When I do the following in the first function:
> > > DiskFileUpload upload = new DiskFileUpload();
> > > List items = upload.parseRequest(request);
> > >
> > > it works fine, but in subsequent functions, the
> > > parameters from the request object are missing.
> > The
> > > following returns zero:
> > > DiskFileUpload upload = new DiskFileUpload();
> > > List items = upload.parseRequest(request);
> > > items.size() <-- This is zero.
> > >
> > > It seems as if the upload.parseRequest(request)
> > > changes the request object.  What is the general
> > > work-around if someone wants to read the parameter
> > of
> > > a multipart request object more than once?
> > >
> > > Any help would be greatly appreciated.
> > >
> > > Thanks,
> > >  Navid Mehregani
> > >
> > >
> >
> ______________________________________________________________________
> > > Post your free ad now! http://personals.yahoo.ca
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > commons-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > commons-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > commons-user-help@jakarta.apache.org
> >
> >
> 
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message