Quantcast

[FileUpload] : multi-part request loosing parameters after first access.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[FileUpload] : multi-part request loosing parameters after first access.

Amey
Hi Folks,

I'm using struts 1.2.9 and having requirement to upload  and process
file, obviously struts is handing multi-part request quite well however
i'm having some existing logic where we have created my own filter from
where all requests pass and i check authorization of user whether he is
allowed to send that request or not.

as struts handle multipart request in its own doFilter and beyond that
code and i need few of the request parameters in my own filter(before
populating form fields) i wrote some code and used Commons FileUpload
jar as below in my filter.

|List<FileItem>items
=newServletFileUpload(newDiskFileItemFactory()).parseRequest(request);|

and i'm getting all the form fields and queryparams in the list, now the
problem is all those parameter are lost once i parsed request here, and
now  from request object and BeanUtil.populate can't set my FormBean. :(
as request object dont have it.

I saw code of fileupload but doesn't seems anything odd code which is
flushing all those parameters Can someone let me know if i'm missing
something here ?


Thanks,

Amey

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fwd: [FileUpload] : multi-part request loosing parameters after first access.

Amey
I'm part of user group but didn't received this mail, not sure if it's
delivered to ML or not , forwarding it again.

-Amey
---------- Forwarded message ----------
From: "Amey" <[hidden email]>
Date: Apr 8, 2017 1:15 AM
Subject: [FileUpload] : multi-part request loosing parameters after first
access.
To: <[hidden email]>
Cc:

Hi Folks,

I'm using struts 1.2.9 and having requirement to upload  and process file,
obviously struts is handing multi-part request quite well however i'm
having some existing logic where we have created my own filter from where
all requests pass and i check authorization of user whether he is allowed
to send that request or not.

as struts handle multipart request in its own doFilter and beyond that code
and i need few of the request parameters in my own filter(before populating
form fields) i wrote some code and used Commons FileUpload jar as below in
my filter.

        List<FileItem> items = new ServletFileUpload(new
DiskFileItemFactory()).parseRequest(request);

and i'm getting all the form fields and queryparams in the list, now the
problem is all those parameter are lost once i parsed request here, and
now  from request object and BeanUtil.populate can't set my FormBean. :( as
request object dont have it.

I saw code of fileupload but doesn't seems anything odd code which is
flushing all those parameters Can someone let me know if i'm missing
something here ?


Thanks,

Amey
Loading...