You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Martin Cooper <mf...@gmail.com> on 2005/04/02 22:43:37 UTC

[fileupload] Re: Using parseRequest(request) more than once

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 <na...@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